wibble
1.1
Main Page
Namespaces
Classes
Files
File List
File Members
wibble
commandline
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
4
#include <
wibble/commandline/core.h
>
5
6
#include <
wibble/test.h
>
7
8
using namespace
wibble::commandline;
9
10
struct
TestCommandlineCore
{
11
12
Test
isSwitch
() {
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
24
Test
eraseAndAdvance
()
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:
Generated on Wed Oct 23 2013 17:14:25 for wibble by
1.8.4