scide: DocManager - report warnings via the status bar
[supercollider.git] / testsuite / supernova / static_allocator_test.cpp
blobe8a08af1ae0d046a44020552a2efcec626fb6648
1 #include <boost/test/unit_test.hpp>
3 #include <list>
4 #include <vector>
5 #include <set>
6 #include <iostream>
8 #include "utilities/static_allocator.hpp"
10 using namespace nova;
11 using namespace std;
13 namespace
16 template <int size, bool b>
17 void test_pool_instatiation(void)
19 static_allocator<int, size, b> alloc;
22 struct initialized_struct
24 initialized_struct(int i):
25 i(i), f(0.2)
28 bool operator<(initialized_struct const & rhs) const
30 return i < rhs.i;
33 int i;
34 double f;
37 template <typename T, bool b>
38 void test_list(void)
40 list<T, static_allocator<T, 8192, b> > vec;
42 for (int i = 0; i != 8192; ++i)
43 vec.push_back(T(i));
47 template <typename T, bool b>
48 void test_vector(void)
50 vector<T, static_allocator<T, 8192, b> > vec;
52 for (int i = 0; i != 8192; ++i)
53 vec.push_back(T(i));
56 template <typename T, bool b>
57 void test_set(void)
59 set<T, std::less<T>, static_allocator<T, 8192, b> > set;
61 for (int i = 0; i != 8192; ++i)
62 set.insert(T(i));
66 BOOST_AUTO_TEST_CASE( static_alloc_test_1 )
68 test_pool_instatiation<16, false>();
69 test_pool_instatiation<128, false>();
70 test_pool_instatiation<1024, false>();
71 test_pool_instatiation<4096, false>();
73 test_pool_instatiation<16, true>();
74 test_pool_instatiation<128, true>();
75 test_pool_instatiation<1024, true>();
76 test_pool_instatiation<4096, true>();
80 #if 0
81 BOOST_AUTO_TEST_CASE( static_alloc_test_2 )
83 test_list<int, false>();
84 test_list<initialized_struct, false>();
86 test_list<int, true>();
87 test_list<initialized_struct, true>();
89 #endif
91 BOOST_AUTO_TEST_CASE( static_alloc_test_3 )
93 test_vector<int, false>();
94 test_vector<initialized_struct, false>();
96 test_vector<int, true>();
97 test_vector<initialized_struct, true>();
100 #if 0
101 BOOST_AUTO_TEST_CASE( static_alloc_test_4 )
103 test_set<int, false>();
104 test_set<initialized_struct, false>();
106 test_set<int, true>();
107 test_set<initialized_struct, true>();
109 #endif