supernova: jack backend - improve xrun handling
[supercollider.git] / testsuite / supernova / server_test.cpp
blobecb771a15356fbf0231e0465fee67fd4eeeea3cb
1 #include <boost/test/unit_test.hpp>
3 #include "server/server.hpp"
4 #include "server/server_args.hpp"
6 #include "test_synth.hpp"
8 using namespace nova;
9 using namespace boost;
12 namespace
14 struct test_synth_prototype:
15 public synth_prototype
17 test_synth_prototype(void):
18 synth_prototype(c_string("foo"))
21 abstract_synth * create_instance(int node_id)
23 return new test_synth(node_id, this);
29 BOOST_AUTO_TEST_CASE( server_test_1 )
31 rt_pool.init(1024 * 1024);
34 nova_server server(server_arguments::initialize(0, 0));
35 rt_pool.init(1024*1024);
37 server.synth_factory::register_prototype(new test_synth_prototype());
39 node_position_constraint to_root = std::make_pair(server.root_group(), insert);
41 abstract_synth * s = server.add_synth("foo", 1, to_root);
42 server.free_node(s);
45 instance = 0;
48 BOOST_AUTO_TEST_CASE( server_test_2 )
51 nova_server server(server_arguments::initialize(0, 0));
52 server.synth_factory::register_prototype(new test_synth_prototype());
54 node_position_constraint to_root = std::make_pair(server.root_group(), insert);
56 abstract_synth * s = server.add_synth("foo", 1, to_root);
57 server();
58 server();
59 server();
60 server.free_node(s);
63 instance = 0;
66 BOOST_AUTO_TEST_CASE( server_test_3 )
69 nova_server server(server_arguments::initialize(0, 0));
70 server.synth_factory::register_prototype(new test_synth_prototype());
72 parallel_group * g = new parallel_group(1);
74 server.add_node(g);
76 node_position_constraint to_group = std::make_pair(g, insert);
78 abstract_synth * s1 = server.add_synth("foo", 2, to_group);
79 abstract_synth * s2 = server.add_synth("foo", 3, to_group);
80 abstract_synth * s3 = server.add_synth("foo", 4, to_group);
81 server();
82 server();
83 server();
84 server.free_node(s1);
85 server.free_node(s2);
86 server.free_node(s3);
89 instance = 0;