Mercurial > irccd
comparison tests/js-elapsedtimer/main.cpp @ 489:349fe29d86d5
Tests: switch to Boost, closes #680
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sun, 20 Aug 2017 08:16:39 +0200 |
parents | 7e273b7f4f92 |
children | 173c52d3120b |
comparison
equal
deleted
inserted
replaced
488:7e273b7f4f92 | 489:349fe29d86d5 |
---|---|
59 } catch (const std::exception &ex) { | 59 } catch (const std::exception &ex) { |
60 FAIL() << ex.what(); | 60 FAIL() << ex.what(); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 TEST_F(TestElapsedTimer, reset) | |
65 { | |
66 try { | |
67 if (duk_peval_string(m_plugin->context(), "timer = new Irccd.ElapsedTimer();") != 0) | |
68 throw dukx_exception(m_plugin->context(), -1); | |
69 | |
70 std::this_thread::sleep_for(300ms); | |
71 | |
72 if (duk_peval_string(m_plugin->context(), "timer.reset(); result = timer.elapsed();") != 0) | |
73 throw dukx_exception(m_plugin->context(), -1); | |
74 | |
75 ASSERT_TRUE(duk_get_global_string(m_plugin->context(), "result")); | |
76 ASSERT_LE(duk_get_int(m_plugin->context(), -1), 100); | |
77 } catch (const std::exception &ex) { | |
78 FAIL() << ex.what(); | |
79 } | |
80 } | |
81 | |
82 int main(int argc, char **argv) | 64 int main(int argc, char **argv) |
83 { | 65 { |
84 testing::InitGoogleTest(&argc, argv); | 66 testing::InitGoogleTest(&argc, argv); |
85 | 67 |
86 return RUN_ALL_TESTS(); | 68 return RUN_ALL_TESTS(); |