inline unary ops: fix sc_floor for non-sse4.1
[supercollider.git] / testsuite / supernova / callback_interpreter_system.cpp
blobf8a37ed3eba586cc54617cb4005068da68d7ba17
1 #include <boost/test/unit_test.hpp>
3 #include <boost/thread.hpp>
4 #include <boost/bind.hpp>
6 #include "utilities/callback_system.hpp"
7 #include "utilities/callback_interpreter.hpp"
8 #include "nova-tt/thread_priority.hpp"
10 using namespace nova;
12 namespace
15 int i = 0;
17 struct dummy
19 void run(void)
21 ++i;
27 BOOST_AUTO_TEST_CASE( callback_system_test )
29 callback_system<dummy> cbs;
31 cbs.add_callback(new dummy());
32 cbs.run_callbacks();
33 BOOST_REQUIRE_EQUAL(i, 1);
36 BOOST_AUTO_TEST_CASE( threaded_callback_interpreter_test )
38 threaded_callback_interpreter<dummy> cbi;
40 cbi.start_thread();
42 for (int j = 0; j != 20; ++j)
43 cbi.add_callback(new dummy());
45 cbi.join_thread();
46 BOOST_REQUIRE_EQUAL(i, 21);
49 BOOST_AUTO_TEST_CASE( callback_interpreter_threadpool_test )
52 callback_interpreter_threadpool<dummy> cbi(4, true, thread_priority_interval().first);
54 for (int j = 0; j != 20; ++j)
55 cbi.add_callback(new dummy());
57 BOOST_REQUIRE_EQUAL(i, 41);