PhoenixPresentation
2.0.0
Set of cmake function to automate presentation generation
main.cpp
Go to the documentation of this file.
1
2
/***************************************
3
Auteur : Pierre Aubert
4
Mail : pierre.aubert@lapp.in2p3.fr
5
Licence : CeCILL-C
6
****************************************/
7
8
#include "
phoenix_assert.h
"
9
#include "
phoenix_check.h
"
10
#include "
ArgParser.h
"
11
13
void
testArgParser
(){
14
ArgParser
arg;
15
ArgParser
arg2(arg);
16
ArgParser
arg3;
17
arg3 = arg;
18
19
arg.
print
();
20
phoenix_assert
(arg.
getNbArgument
() == 0lu);
21
arg.
rewind
();
22
}
23
25
28
bool
testConstGetCurrentOption
(
const
ArgParser
& arg){
29
return
arg.
getCurrentOption
() !=
""
;
30
}
31
33
35
bool
testArgParserArg
(
int
argc,
char
** argv){
36
bool
b(
true
);
37
38
ArgParser
arg(argc, argv);
39
ArgParser
arg2(arg);
40
ArgParser
arg3;
41
arg3 = arg;
42
43
arg.
print
();
44
b &= arg.
getNbArgument
() != 0lu;
45
46
if
(arg.
getNbArgument
() != 0lu){
47
arg.
print
();
48
b &= arg.
getCurrentOption
() !=
""
;
49
b &=
testConstGetCurrentOption
(arg);
50
}
51
52
arg.
rewind
();
53
return
b;
54
}
55
57
void
testRemaningArgument
(
int
argc,
char
** argv){
58
ArgParser
arg(argc, argv);
59
phoenix_assert
(arg.
getRemainingArgument
() ==
"--option=val"
);
60
}
61
62
int
main
(
int
argc,
char
** argv){
63
testArgParser
();
64
phoenix_assert
(
testArgParserArg
(argc, argv));
65
phoenix_assert
(!
testArgParserArg
(0, argv));
66
testRemaningArgument
(argc, argv);
67
return
0;
68
}
69
70
ArgParser.h
main
int main(int argc, char **argv)
Definition:
main.cpp:228
testRemaningArgument
void testRemaningArgument(int argc, char **argv)
Test of getRemainingArgument.
Definition:
main.cpp:57
testConstGetCurrentOption
bool testConstGetCurrentOption(const ArgParser &arg)
Test the ArgParser.
Definition:
main.cpp:28
testArgParser
void testArgParser()
Test the ArgParser.
Definition:
main.cpp:13
testArgParserArg
bool testArgParserArg(int argc, char **argv)
Test the ArgParser.
Definition:
main.cpp:35
ArgParser
Parse the list of arguments passed to a program.
Definition:
ArgParser.h:13
ArgParser::print
void print() const
Print all the input option.
Definition:
ArgParser.cpp:65
ArgParser::getCurrentOption
const PString & getCurrentOption() const
Get the current option.
Definition:
ArgParser.cpp:91
ArgParser::rewind
void rewind()
Go bask to the first argument.
Definition:
ArgParser.cpp:72
ArgParser::getNbArgument
size_t getNbArgument() const
Get the number of arguments passed to the program.
Definition:
ArgParser.cpp:105
ArgParser::getRemainingArgument
PString getRemainingArgument()
Get all remaining arguments of the ArgParser.
Definition:
ArgParser.cpp:133
phoenix_assert.h
phoenix_assert
#define phoenix_assert(isOk)
Definition:
phoenix_assert.h:19
phoenix_check.h
tmp_project
PhoenixBeamerCreator
tmp_project
PhoenixOptionParser
TESTS
TEST_ARGPARSER
main.cpp
Generated on Fri Mar 14 2025 15:50:10 for PhoenixPresentation by
1.9.1