comparison tests/js-elapsedtimer/main.cpp @ 565:194162717ec9

Irccd: bring new duktape.hpp
author David Demelier <markand@malikania.fr>
date Mon, 27 Nov 2017 10:16:45 +0100
parents b3a0f61a35fe
children bf56628e070b
comparison
equal deleted inserted replaced
564:b8ebbc74da0c 565:194162717ec9
32 BOOST_FIXTURE_TEST_SUITE(elapsed_timer_jsapi_suite, js_test<elapsed_timer_jsapi>) 32 BOOST_FIXTURE_TEST_SUITE(elapsed_timer_jsapi_suite, js_test<elapsed_timer_jsapi>)
33 33
34 BOOST_AUTO_TEST_CASE(standard) 34 BOOST_AUTO_TEST_CASE(standard)
35 { 35 {
36 if (duk_peval_string(plugin_->context(), "timer = new Irccd.ElapsedTimer();") != 0) 36 if (duk_peval_string(plugin_->context(), "timer = new Irccd.ElapsedTimer();") != 0)
37 throw dukx_exception(plugin_->context(), -1); 37 throw dukx_get_exception(plugin_->context(), -1);
38 38
39 std::this_thread::sleep_for(300ms); 39 std::this_thread::sleep_for(300ms);
40 40
41 if (duk_peval_string(plugin_->context(), "result = timer.elapsed();") != 0) 41 if (duk_peval_string(plugin_->context(), "result = timer.elapsed();") != 0)
42 throw dukx_exception(plugin_->context(), -1); 42 throw dukx_get_exception(plugin_->context(), -1);
43 43
44 BOOST_REQUIRE(duk_get_global_string(plugin_->context(), "result")); 44 BOOST_REQUIRE(duk_get_global_string(plugin_->context(), "result"));
45 BOOST_REQUIRE_GE(duk_get_int(plugin_->context(), -1), 250); 45 BOOST_REQUIRE_GE(duk_get_int(plugin_->context(), -1), 250);
46 BOOST_REQUIRE_LE(duk_get_int(plugin_->context(), -1), 350); 46 BOOST_REQUIRE_LE(duk_get_int(plugin_->context(), -1), 350);
47 } 47 }