class library: Spawner - don't access PriorityQueue-array
[supercollider.git] / testsuite / supernova / simple_pool_test.cpp
blob93831e3b965f83b1e7c1cedc4639b1c5e6d3a61f
1 #include <boost/test/unit_test.hpp>
3 #include <string>
5 #include "utilities/simple_pool.hpp"
7 using namespace nova;
8 using namespace std;
10 namespace
13 struct foo
15 foo(void)
17 int data[4];
20 void run_simple_test(bool locked)
22 simple_pool<> pool(16*1024, locked);
24 foo* f1 = static_cast<foo*>(pool.malloc(sizeof(f1)));
25 ::new(f1) foo();
26 f1->~foo();
27 pool.free(f1);
30 void run_simple_test_2(bool locked)
32 simple_pool<> pool;
34 pool.init(16*1024, locked);
36 foo* f1 = static_cast<foo*>(pool.malloc(sizeof(f1)));
37 ::new(f1) foo();
38 f1->~foo();
39 pool.free(f1);
44 BOOST_AUTO_TEST_CASE( simple_pool_tests )
46 run_simple_test(false);
47 run_simple_test(true);
48 run_simple_test_2(false);
49 run_simple_test_2(true);