wibble 1.1
core.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
5
6#include <wibble/test.h>
7
8using namespace wibble::commandline;
9
11
13 assert_eq(ArgList::isSwitch("-a"), true);
14 assert_eq(ArgList::isSwitch("-afdg"), true);
15 assert_eq(ArgList::isSwitch("--antani"), true);
16 assert_eq(ArgList::isSwitch("--antani-blinda"), true);
17 assert_eq(ArgList::isSwitch("-"), false);
18 assert_eq(ArgList::isSwitch("--"), false);
19 assert_eq(ArgList::isSwitch("antani"), false);
20 assert_eq(ArgList::isSwitch("a-ntani"), false);
21 assert_eq(ArgList::isSwitch("a--ntani"), false);
22 }
23
25 {
26 ArgList list;
27 list.push_back("1");
28 list.push_back("2");
29 list.push_back("3");
30
31 ArgList::iterator begin = list.begin();
32 assert_eq(list.size(), 3u);
33
34 list.eraseAndAdvance(begin);
35 assert(begin == list.begin());
36 assert_eq(list.size(), 2u);
37
38 list.eraseAndAdvance(begin);
39 assert(begin == list.begin());
40 assert_eq(list.size(), 1u);
41
42 list.eraseAndAdvance(begin);
43 assert(begin == list.begin());
44 assert_eq(list.size(), 0u);
45 assert(begin == list.end());
46 }
47
48};
49
50// vim:set ts=4 sw=4:
Definition core.h:30
iterator & eraseAndAdvance(iterator &i)
Definition core.h:34
static bool isSwitch(const char *str)
Definition core.cpp:36
Definition core.cpp:6
Definition core.test.h:10
Test isSwitch()
Definition core.test.h:12
Test eraseAndAdvance()
Definition core.test.h:24
Definition amorph.h:30
#define assert_eq(x, y)
Definition test.h:33
#define assert(x)
Definition test.h:30