| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #include "assert.h" | ||
| 8 | |||
| 9 | #include "Representation.h" | ||
| 10 | |||
| 11 | ///Check the equality between two Function classes | ||
| 12 | /** @param var : variable to be checked | ||
| 13 | * @param reference : reference | ||
| 14 | * @return true on success, false otherwise | ||
| 15 | */ | ||
| 16 | 2 | bool checkFunctionEquality(Function & var, Function & reference){ | |
| 17 | 2 | bool b(true); | |
| 18 | 2 | b &= var.getName() == reference.getName(); | |
| 19 | 2 | b &= var.getDescription() == reference.getDescription(); | |
| 20 | 2 | return b; | |
| 21 | } | ||
| 22 | |||
| 23 | ///Check the equality between two Function classes | ||
| 24 | /** @param var : variable to be checked | ||
| 25 | * @param reference : reference | ||
| 26 | * @return true on success, false otherwise | ||
| 27 | */ | ||
| 28 | 2 | bool checkFunctionEqualityConst(const Function & var, const Function & reference){ | |
| 29 | 2 | bool b(true); | |
| 30 | 2 | b &= var.getName() == reference.getName(); | |
| 31 | 2 | b &= var.getDescription() == reference.getDescription(); | |
| 32 | 2 | return b; | |
| 33 | } | ||
| 34 | |||
| 35 | ///Check copy of class Function | ||
| 36 | 1 | void checkFunctionCopy(){ | |
| 37 |
1/1✓ Branch 0 (2→3) taken 1 times.
|
1 | Function reference; |
| 38 | //Let's use the setters | ||
| 39 |
2/2✓ Branch 0 (3→4) taken 1 times.
✓ Branch 2 (4→5) taken 1 times.
|
1 | reference.setName("Some string"); |
| 40 |
2/2✓ Branch 0 (6→7) taken 1 times.
✓ Branch 2 (7→8) taken 1 times.
|
1 | reference.setDescription("Some string"); |
| 41 |
1/1✓ Branch 0 (9→10) taken 1 times.
|
1 | Function varCopy(reference); |
| 42 |
1/1✓ Branch 0 (10→11) taken 1 times.
|
1 | Function varEqual; |
| 43 |
1/1✓ Branch 0 (11→12) taken 1 times.
|
1 | varEqual = reference; |
| 44 |
2/3✓ Branch 0 (12→13) taken 1 times.
✗ Branch 2 (13→14) not taken.
✓ Branch 3 (13→15) taken 1 times.
|
1 | assert(checkFunctionEquality(varCopy, reference)); |
| 45 |
2/3✓ Branch 0 (15→16) taken 1 times.
✗ Branch 2 (16→17) not taken.
✓ Branch 3 (16→18) taken 1 times.
|
1 | assert(checkFunctionEqualityConst(varCopy, reference)); |
| 46 |
2/3✓ Branch 0 (18→19) taken 1 times.
✗ Branch 2 (19→20) not taken.
✓ Branch 3 (19→21) taken 1 times.
|
1 | assert(checkFunctionEquality(varEqual, reference)); |
| 47 |
2/3✓ Branch 0 (21→22) taken 1 times.
✗ Branch 2 (22→23) not taken.
✓ Branch 3 (22→24) taken 1 times.
|
1 | assert(checkFunctionEqualityConst(varEqual, reference)); |
| 48 | 1 | } | |
| 49 | |||
| 50 | ///Check TypeStream of class Function | ||
| 51 | 1 | void checkFunctionTypeStream(){ | |
| 52 |
3/4✓ Branch 0 (2→3) taken 1 times.
✓ Branch 2 (3→4) taken 1 times.
✗ Branch 4 (4→5) not taken.
✓ Branch 5 (4→6) taken 1 times.
|
1 | assert(phoenix_getTypeToStr<Function>() == "Function"); |
| 53 | 1 | } | |
| 54 | |||
| 55 | 1 | int main(int argc, char ** argv){ | |
| 56 | 1 | checkFunctionCopy(); | |
| 57 | 1 | checkFunctionTypeStream(); | |
| 58 | 1 | return 0; | |
| 59 | } | ||
| 60 |