GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/OptionParser/TESTS/TEST_ARGPARSER/main.cpp Lines: 30 30 100.0 %
Date: 2024-12-09 15:30:52 Branches: 35 35 100.0 %

Line Branch Exec Source
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
12
///Test the ArgParser
13
1
void testArgParser(){
14
2
	ArgParser arg;
15
2
	ArgParser arg2(arg);
16
2
	ArgParser arg3;
17
1
	arg3 = arg;
18
19
1
	arg.print();
20

1
	phoenix_assert(arg.getNbArgument() == 0lu);
21
1
	arg.rewind();
22
1
}
23
24
///Test the ArgParser
25
/**	@param arg : constant ArgParser to be tested
26
 * 	@return true on success, false otherwise
27
*/
28
1
bool testConstGetCurrentOption(const ArgParser & arg){
29
1
	return arg.getCurrentOption() != "";
30
}
31
32
///Test the ArgParser
33
/**	@return true on success, false otherwise
34
*/
35
2
bool testArgParserArg(int argc, char** argv){
36
2
	bool b(true);
37
38
4
	ArgParser arg(argc, argv);
39
4
	ArgParser arg2(arg);
40
2
	ArgParser arg3;
41
2
	arg3 = arg;
42
43
2
	arg.print();
44
2
	b &= arg.getNbArgument() != 0lu;
45
46
2
	if(arg.getNbArgument() != 0lu){
47
1
		arg.print();
48
1
		b &= arg.getCurrentOption() != "";
49
1
		b &= testConstGetCurrentOption(arg);
50
	}
51
52
2
	arg.rewind();
53
4
	return b;
54
}
55
56
1
int main(int argc, char** argv){
57
1
	testArgParser();
58

1
	phoenix_assert(testArgParserArg(argc, argv));
59

1
	phoenix_assert(!testArgParserArg(0, argv));
60
1
	return 0;
61
}
62
63