wibble  1.1
singleton.test.h
Go to the documentation of this file.
1 /* -*- C++ -*- (c) 2007 Petr Rockai <me@mornfall.net>
2  (c) 2007 Enrico Zini <enrico@enricozini.org> */
3 
4 #include <wibble/test.h>
5 #include <wibble/singleton.h>
6 
7 namespace {
8 
9 using namespace std;
10 using namespace wibble;
11 
12 struct TestSingleton {
13 
14  Test simple() {
15  Singleton<int> container = singleton(5);
16 
17  assert_eq(container.size(), 1u);
18 
19  Singleton<int>::iterator i = container.begin();
20  assert(!(i == container.end()));
21  assert(i != container.end());
22  assert_eq(*i, 5);
23 
24  ++i;
25  assert(i == container.end());
26  assert(!(i != container.end()));
27  }
28 
29 };
30 
31 }
Definition: singleton.h:60
Definition: singleton.h:33
size_t size() const
Definition: singleton.h:82
iterator begin()
Definition: singleton.h:84
iterator end()
Definition: singleton.h:85
Definition: amorph.h:17
Singleton< T > singleton(const T &value)
Definition: singleton.h:102
void Test
Definition: test.h:178
#define assert_eq(x, y)
Definition: test.h:33
#define assert(x)
Definition: test.h:30