wibble
1.1
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:
wibble::iterator
Iterator< typename I::value_type > iterator(I i)
Definition:
iterator.h:123
TestCommandlineCore::isSwitch
Test isSwitch()
Definition:
core.test.h:12
wibble::commandline::ArgList
Definition:
core.h:29
wibble::commandline
Definition:
core.cpp:6
wibble::commandline::ArgList::isSwitch
static bool isSwitch(const char *str)
Definition:
core.cpp:36
test.h
assert_eq
#define assert_eq(x, y)
Definition:
test.h:33
TestCommandlineCore::eraseAndAdvance
Test eraseAndAdvance()
Definition:
core.test.h:24
wibble::list::begin
ListIterator< List > begin(List l)
Definition:
list.h:420
core.h
wibble::commandline::ArgList::eraseAndAdvance
iterator & eraseAndAdvance(iterator &i)
Definition:
core.h:34
TestCommandlineCore
Definition:
core.test.h:10
Test
void Test
Definition:
test.h:178
assert
#define assert(x)
Definition:
test.h:30
Generated by
1.8.17