class library: Spawner - don't access PriorityQueue-array
[supercollider.git] / testsuite / supernova / tl_allocator_test.cpp
blob7d6603aa53ed7a133d7147b3173a9e001ad42b19
1 #include <boost/test/unit_test.hpp>
3 #include <list>
4 #include <vector>
5 #include <set>
6 #include <iostream>
8 #include "utilities/tl_allocator.hpp"
10 using namespace nova;
11 using namespace std;
13 namespace
16 struct initialized_struct
18 initialized_struct(int i):
19 i(i), f(0.2)
22 bool operator<(initialized_struct const & rhs) const
24 return i < rhs.i;
27 int i;
28 double f;
31 template <typename T>
32 void test_list(void)
34 list<T, tl_allocator<T> > vec;
36 for (int i = 0; i != 8192; ++i)
37 vec.push_back(T(i));
41 template <typename T>
42 void test_vector(void)
44 vector<T, tl_allocator<T> > vec;
46 for (int i = 0; i != 8192; ++i)
47 vec.push_back(T(i));
50 template <typename T>
51 void test_set(void)
53 set<T, std::less<T>, tl_allocator<T> > set;
55 for (int i = 0; i != 8192; ++i)
56 set.insert(T(i));
61 BOOST_AUTO_TEST_CASE( rt_alloc_test_1 )
63 detail::tl_allocator<8 * 1024 * 1024> rt_alloc;
66 BOOST_AUTO_TEST_CASE( rt_alloc_test_2 )
68 test_list<int>();
69 test_list<initialized_struct>();
72 BOOST_AUTO_TEST_CASE( rt_alloc_test_3 )
74 test_vector<int>();
75 test_vector<initialized_struct>();
78 BOOST_AUTO_TEST_CASE( rt_alloc_test_4 )
80 test_set<int>();
81 test_set<initialized_struct>();