GCC Code Coverage Report


Directory: ./
File: TESTS/TEST_OPTION_TYPE/main.cpp
Date: 2024-07-27 10:53:27
Exec Total Coverage
Lines: 50 50 100.0%
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
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionTypeCompatible(OptionType::SHORT, OptionType::SHORT));
15
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionTypeCompatible(OptionType::SHORT, OptionType::CHAR));
16
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionTypeCompatible(OptionType::STRING, OptionType::FILE_OR_DIR));
17
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(!isOptionTypeCompatible(OptionType::SHORT, OptionType::FLOAT));
18 1 }
19
20 ///Test the option type
21 1 void testOptionType(){
22
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<bool>() == OptionType::BOOL);
23
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<char>() == OptionType::CHAR);
24
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<unsigned char>() == OptionType::UCHAR);
25
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<short>() == OptionType::SHORT);
26
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<unsigned short>() == OptionType::USHORT);
27
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<int>() == OptionType::INT);
28
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<unsigned int>() == OptionType::UINT);
29
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<long>() == OptionType::LONG);
30
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<unsigned long>() == OptionType::ULONG);
31
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<std::string>() == OptionType::STRING);
32
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<float>() == OptionType::FLOAT);
33
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(getOptionTypeFromType<double>() == OptionType::DOUBLE);
34
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::NONE) == "NONE");
35
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::BOOL) == "BOOL");
36
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::CHAR) == "CHAR");
37
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::UCHAR) == "UCHAR");
38
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::SHORT) == "SHORT");
39
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::USHORT) == "USHORT");
40
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::INT) == "INT");
41
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::UINT) == "UINT");
42
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::LONG) == "LONG");
43
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::ULONG) == "ULONG");
44
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::FLOAT) == "FLOAT");
45
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::DOUBLE) == "DOUBLE");
46
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::FILE_OR_DIR) == "FILE_OR_DIR");
47
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::FILENAME) == "FILENAME");
48
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString(OptionType::DIRECTORY) == "DIRECTORY");
49
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(convertOptionTypeToString((OptionType::OptionType)42) == "");
50
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionStringFileDir(OptionType::FILENAME));
51
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionStringFileDir(OptionType::DIRECTORY));
52
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionStringFileDir(OptionType::FILE_OR_DIR));
53
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionStringFileDir(OptionType::STRING));
54
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionFloatingPoint(OptionType::FLOAT));
55
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionFloatingPoint(OptionType::DOUBLE));
56
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionInteger(OptionType::INT));
57
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionInteger(OptionType::UINT));
58
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(isOptionSignedInteger(OptionType::INT));
59
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
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
69