comparison tests/js-timer/main.cpp @ 521:e03521cf207b

Common: split util.hpp into more appropriate files, closes #721
author David Demelier <markand@malikania.fr>
date Fri, 27 Oct 2017 21:45:32 +0200
parents 173c52d3120b
children 5df38b4fbc55
comparison
equal deleted inserted replaced
520:defacef00c82 521:e03521cf207b
20 #include <boost/test/unit_test.hpp> 20 #include <boost/test/unit_test.hpp>
21 #include <boost/timer/timer.hpp> 21 #include <boost/timer/timer.hpp>
22 22
23 #include <irccd/js_plugin_module.hpp> 23 #include <irccd/js_plugin_module.hpp>
24 #include <irccd/js_timer_module.hpp> 24 #include <irccd/js_timer_module.hpp>
25 #include <irccd/net_util.hpp>
25 26
26 #include <js_test.hpp> 27 #include <js_test.hpp>
27 28
28 namespace irccd { 29 namespace irccd {
29 30
39 fixture f(DIRECTORY "/timer-single.js"); 40 fixture f(DIRECTORY "/timer-single.js");
40 41
41 boost::timer::cpu_timer timer; 42 boost::timer::cpu_timer timer;
42 43
43 while (timer.elapsed().wall / 1000000LL < 3000) 44 while (timer.elapsed().wall / 1000000LL < 3000)
44 util::poller::poll(512, f.irccd_); 45 net_util::poll(512, f.irccd_);
45 46
46 BOOST_TEST(duk_get_global_string(f.plugin_->context(), "count")); 47 BOOST_TEST(duk_get_global_string(f.plugin_->context(), "count"));
47 BOOST_TEST(duk_get_int(f.plugin_->context(), -1) == 1); 48 BOOST_TEST(duk_get_int(f.plugin_->context(), -1) == 1);
48 } 49 }
49 50
52 fixture f(DIRECTORY "/timer-repeat.js"); 53 fixture f(DIRECTORY "/timer-repeat.js");
53 54
54 boost::timer::cpu_timer timer; 55 boost::timer::cpu_timer timer;
55 56
56 while (timer.elapsed().wall / 1000000LL < 3000) 57 while (timer.elapsed().wall / 1000000LL < 3000)
57 util::poller::poll(512, f.irccd_); 58 net_util::poll(512, f.irccd_);
58 59
59 BOOST_TEST(duk_get_global_string(f.plugin_->context(), "count")); 60 BOOST_TEST(duk_get_global_string(f.plugin_->context(), "count"));
60 BOOST_TEST(duk_get_int(f.plugin_->context(), -1) >= 5); 61 BOOST_TEST(duk_get_int(f.plugin_->context(), -1) >= 5);
61 } 62 }
62 63