| 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 | using namespace Swarm; | ||
| 12 | |||
| 13 | ///Check the equality between two Stat classes | ||
| 14 | /** @param var : variable to be checked | ||
| 15 | * @param reference : reference | ||
| 16 | * @return true on success, false otherwise | ||
| 17 | */ | ||
| 18 | 2 | bool checkStatEquality(Stat & var, Stat & reference){ | |
| 19 | 2 | bool b(true); | |
| 20 | 2 | b &= var.getName() == reference.getName(); | |
| 21 | 2 | return b; | |
| 22 | } | ||
| 23 | |||
| 24 | ///Check the equality between two Stat classes | ||
| 25 | /** @param var : variable to be checked | ||
| 26 | * @param reference : reference | ||
| 27 | * @return true on success, false otherwise | ||
| 28 | */ | ||
| 29 | 2 | bool checkStatEqualityConst(const Stat & var, const Stat & reference){ | |
| 30 | 2 | bool b(true); | |
| 31 | 2 | b &= var.getName() == reference.getName(); | |
| 32 | 2 | return b; | |
| 33 | } | ||
| 34 | |||
| 35 | ///Check copy of class Stat | ||
| 36 | 1 | void checkStatCopy(){ | |
| 37 |
1/1✓ Branch 0 (2→3) taken 1 times.
|
1 | Stat 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 |
1/1✓ Branch 0 (6→7) taken 1 times.
|
1 | Stat varCopy(reference); |
| 41 |
1/1✓ Branch 0 (7→8) taken 1 times.
|
1 | Stat varEqual; |
| 42 |
1/1✓ Branch 0 (8→9) taken 1 times.
|
1 | varEqual = reference; |
| 43 |
2/3✓ Branch 0 (9→10) taken 1 times.
✗ Branch 2 (10→11) not taken.
✓ Branch 3 (10→12) taken 1 times.
|
1 | assert(checkStatEquality(varCopy, 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(checkStatEqualityConst(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(checkStatEquality(varEqual, 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(checkStatEqualityConst(varEqual, reference)); |
| 47 | 1 | } | |
| 48 | |||
| 49 | ///Check TypeStream of class Stat | ||
| 50 | 1 | void checkStatTypeStream(){ | |
| 51 |
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<Stat>() == "Stat"); |
| 52 | 1 | } | |
| 53 | |||
| 54 | 1 | int main(int argc, char ** argv){ | |
| 55 | 1 | checkStatCopy(); | |
| 56 | 1 | checkStatTypeStream(); | |
| 57 | 1 | return 0; | |
| 58 | } | ||
| 59 |