GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/OptionParser/TESTS/TEST_OPTION_TYPE/main.cpp Lines: 50 50 100.0 %
Date: 2024-09-10 03:06:26 Branches: 210 210 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 "OptionType.h"
11
12
///Test the option type compatible
13
1
void isOptionTypeCompatible(){
14

1
	phoenix_assert(isOptionTypeCompatible(OptionType::SHORT, OptionType::SHORT));
15

1
	phoenix_assert(isOptionTypeCompatible(OptionType::SHORT, OptionType::CHAR));
16

1
	phoenix_assert(isOptionTypeCompatible(OptionType::STRING, OptionType::FILE_OR_DIR));
17

1
	phoenix_assert(!isOptionTypeCompatible(OptionType::SHORT, OptionType::FLOAT));
18
1
}
19
20
///Test the option type
21
1
void testOptionType(){
22

1
	phoenix_assert(getOptionTypeFromType<bool>() == OptionType::BOOL);
23

1
	phoenix_assert(getOptionTypeFromType<char>() == OptionType::CHAR);
24

1
	phoenix_assert(getOptionTypeFromType<unsigned char>() == OptionType::UCHAR);
25

1
	phoenix_assert(getOptionTypeFromType<short>() == OptionType::SHORT);
26

1
	phoenix_assert(getOptionTypeFromType<unsigned short>() == OptionType::USHORT);
27

1
	phoenix_assert(getOptionTypeFromType<int>() == OptionType::INT);
28

1
	phoenix_assert(getOptionTypeFromType<unsigned int>() == OptionType::UINT);
29

1
	phoenix_assert(getOptionTypeFromType<long>() == OptionType::LONG);
30

1
	phoenix_assert(getOptionTypeFromType<unsigned long>() == OptionType::ULONG);
31

1
	phoenix_assert(getOptionTypeFromType<std::string>() == OptionType::STRING);
32

1
	phoenix_assert(getOptionTypeFromType<float>() == OptionType::FLOAT);
33

1
	phoenix_assert(getOptionTypeFromType<double>() == OptionType::DOUBLE);
34

1
	phoenix_assert(convertOptionTypeToString(OptionType::NONE) == "NONE");
35

1
	phoenix_assert(convertOptionTypeToString(OptionType::BOOL) == "BOOL");
36

1
	phoenix_assert(convertOptionTypeToString(OptionType::CHAR) == "CHAR");
37

1
	phoenix_assert(convertOptionTypeToString(OptionType::UCHAR) == "UCHAR");
38

1
	phoenix_assert(convertOptionTypeToString(OptionType::SHORT) == "SHORT");
39

1
	phoenix_assert(convertOptionTypeToString(OptionType::USHORT) == "USHORT");
40

1
	phoenix_assert(convertOptionTypeToString(OptionType::INT) == "INT");
41

1
	phoenix_assert(convertOptionTypeToString(OptionType::UINT) == "UINT");
42

1
	phoenix_assert(convertOptionTypeToString(OptionType::LONG) == "LONG");
43

1
	phoenix_assert(convertOptionTypeToString(OptionType::ULONG) == "ULONG");
44

1
	phoenix_assert(convertOptionTypeToString(OptionType::FLOAT) == "FLOAT");
45

1
	phoenix_assert(convertOptionTypeToString(OptionType::DOUBLE) == "DOUBLE");
46

1
	phoenix_assert(convertOptionTypeToString(OptionType::FILE_OR_DIR) == "FILE_OR_DIR");
47

1
	phoenix_assert(convertOptionTypeToString(OptionType::FILENAME) == "FILENAME");
48

1
	phoenix_assert(convertOptionTypeToString(OptionType::DIRECTORY) == "DIRECTORY");
49

1
	phoenix_assert(convertOptionTypeToString((OptionType::OptionType)42) == "");
50

1
	phoenix_assert(isOptionStringFileDir(OptionType::FILENAME));
51

1
	phoenix_assert(isOptionStringFileDir(OptionType::DIRECTORY));
52

1
	phoenix_assert(isOptionStringFileDir(OptionType::FILE_OR_DIR));
53

1
	phoenix_assert(isOptionStringFileDir(OptionType::STRING));
54

1
	phoenix_assert(isOptionFloatingPoint(OptionType::FLOAT));
55

1
	phoenix_assert(isOptionFloatingPoint(OptionType::DOUBLE));
56

1
	phoenix_assert(isOptionInteger(OptionType::INT));
57

1
	phoenix_assert(isOptionInteger(OptionType::UINT));
58

1
	phoenix_assert(isOptionSignedInteger(OptionType::INT));
59

1
	phoenix_assert(isOptionUnsignedInteger(OptionType::UINT));
60
1
}
61
62
1
int main(int argc, char** argv){
63
1
	testOptionType();
64
1
	isOptionTypeCompatible();
65
1
	return 0;
66
}
67
68