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 }
wibble::Singleton
Definition: singleton.h:32
singleton.h
wibble::Singleton::iterator
Definition: singleton.h:59
wibble::singleton
Singleton< T > singleton(const T &value)
Definition: singleton.h:102
test.h
assert_eq
#define assert_eq(x, y)
Definition: test.h:33
wibble::Singleton::begin
iterator begin()
Definition: singleton.h:84
wibble
Definition: amorph.h:17
wibble::Singleton::end
iterator end()
Definition: singleton.h:85
Test
void Test
Definition: test.h:178
wibble::Singleton::size
size_t size() const
Definition: singleton.h:82
assert
#define assert(x)
Definition: test.h:30