| 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 <iostream> | ||
| 9 | #include "phoenix_program_call.h" | ||
| 10 | |||
| 11 | ///Check ProgramCall const reference | ||
| 12 | /** @return true on success, false otherwise | ||
| 13 | */ | ||
| 14 | 2 | bool checkProgramCallConst(const ProgramCall & call){ | |
| 15 | 2 | bool b(true); | |
| 16 | 2 | b &= call.getName() == "name"; | |
| 17 | 2 | b &= call.getCommand() == "command"; | |
| 18 | 2 | b &= call.getWorkingDirectory() == "workingDirectory"; | |
| 19 | 2 | b &= call.getExitStatus() == 1; | |
| 20 | 2 | b &= call.getLogFile() == "logFile"; | |
| 21 | 2 | std::cout << "checkProgramCallRef : b = " << b << std::endl; | |
| 22 | 2 | return b; | |
| 23 | } | ||
| 24 | |||
| 25 | ///Check ProgramCall reference | ||
| 26 | /** @return true on success, false otherwise | ||
| 27 | */ | ||
| 28 | 2 | bool checkProgramCallRef(ProgramCall & call){ | |
| 29 | 2 | bool b(true); | |
| 30 | 2 | b &= call.getName() == "name"; | |
| 31 | 2 | b &= call.getCommand() == "command"; | |
| 32 | 2 | b &= call.getWorkingDirectory() == "workingDirectory"; | |
| 33 | 2 | b &= call.getExitStatus() == 1; | |
| 34 | 2 | b &= call.getLogFile() == "logFile"; | |
| 35 | 2 | std::cout << "checkProgramCallRef : b = " << b << std::endl; | |
| 36 | 2 | return b; | |
| 37 | } | ||
| 38 | |||
| 39 | ///Check basic ProgramCall | ||
| 40 | /** @return true on success, false otherwise | ||
| 41 | */ | ||
| 42 | 1 | bool testBaseProgramCall(){ | |
| 43 |
1/1✓ Branch 0 (2→3) taken 1 times.
|
1 | ProgramCall call; |
| 44 |
2/2✓ Branch 0 (3→4) taken 1 times.
✓ Branch 2 (4→5) taken 1 times.
|
1 | call.setName("name"); |
| 45 |
2/2✓ Branch 0 (6→7) taken 1 times.
✓ Branch 2 (7→8) taken 1 times.
|
1 | call.setCommand("command"); |
| 46 |
3/3✓ Branch 0 (9→10) taken 1 times.
✓ Branch 2 (10→11) taken 1 times.
✓ Branch 4 (11→12) taken 1 times.
|
1 | call.setWorkingDirectory(PPath("workingDirectory")); |
| 47 |
1/1✓ Branch 0 (14→15) taken 1 times.
|
1 | call.setExitStatus(1); |
| 48 |
3/3✓ Branch 0 (15→16) taken 1 times.
✓ Branch 2 (16→17) taken 1 times.
✓ Branch 4 (17→18) taken 1 times.
|
1 | call.setLogFile(PPath("logFile")); |
| 49 | |||
| 50 |
2/2✓ Branch 0 (20→21) taken 1 times.
✓ Branch 2 (21→22) taken 1 times.
|
1 | ProgramCall callCopy(call), callEqual; |
| 51 |
1/1✓ Branch 0 (22→23) taken 1 times.
|
1 | callEqual = call; |
| 52 | |||
| 53 | 1 | bool b(true); | |
| 54 |
1/1✓ Branch 0 (23→24) taken 1 times.
|
1 | b &= checkProgramCallConst(callCopy); |
| 55 |
1/1✓ Branch 0 (24→25) taken 1 times.
|
1 | b &= checkProgramCallRef(callCopy); |
| 56 |
1/1✓ Branch 0 (25→26) taken 1 times.
|
1 | b &= checkProgramCallConst(callEqual); |
| 57 |
1/1✓ Branch 0 (26→27) taken 1 times.
|
1 | b &= checkProgramCallRef(callEqual); |
| 58 |
3/3✓ Branch 0 (27→28) taken 1 times.
✓ Branch 2 (28→29) taken 1 times.
✓ Branch 4 (29→30) taken 1 times.
|
1 | std::cout << "testBaseProgramCall : b = " << b << std::endl; |
| 59 | 1 | return b; | |
| 60 | 1 | } | |
| 61 | |||
| 62 | ///Test program call | ||
| 63 | /** @return true on success, false otherwise | ||
| 64 | */ | ||
| 65 | 1 | bool testProgramCall(){ | |
| 66 | 1 | VecProgramCall vecCall; | |
| 67 | |||
| 68 |
6/6✓ Branch 0 (3→4) taken 1 times.
✓ Branch 2 (4→5) taken 1 times.
✓ Branch 4 (5→6) taken 1 times.
✓ Branch 6 (6→7) taken 1 times.
✓ Branch 8 (7→8) taken 1 times.
✓ Branch 10 (8→9) taken 1 times.
|
1 | phoenix_program_addcall(vecCall, "simple ls", "ls", PPath("")); |
| 69 |
7/7✓ Branch 0 (14→15) taken 1 times.
✓ Branch 2 (15→16) taken 1 times.
✓ Branch 4 (16→17) taken 1 times.
✓ Branch 6 (17→18) taken 1 times.
✓ Branch 8 (18→19) taken 1 times.
✓ Branch 10 (19→20) taken 1 times.
✓ Branch 12 (20→21) taken 1 times.
|
1 | phoenix_program_addcall(vecCall, "simple ls", "ls", PPath("./"), PPath("someLogFile.log")); |
| 70 | |||
| 71 |
1/1✓ Branch 0 (27→28) taken 1 times.
|
1 | phoenix_program_callVec(vecCall); |
| 72 | 1 | bool b(true); | |
| 73 |
1/1✓ Branch 0 (28→29) taken 1 times.
|
1 | b &= phoenix_program_getNbSuccessCall(vecCall) == 2lu; |
| 74 | 1 | VecVecProgramCall vecVecCall; | |
| 75 |
1/1✓ Branch 0 (30→31) taken 1 times.
|
1 | vecVecCall.push_back(vecCall); |
| 76 |
1/1✓ Branch 0 (31→32) taken 1 times.
|
1 | b &= phoenix_program_getNbSuccessCall(vecVecCall) == 2lu; |
| 77 |
1/1✓ Branch 0 (32→33) taken 1 times.
|
1 | b &= phoenix_program_getNbCall(vecVecCall) == 2lu; |
| 78 |
3/3✓ Branch 0 (33→34) taken 1 times.
✓ Branch 2 (34→35) taken 1 times.
✓ Branch 4 (35→36) taken 1 times.
|
1 | std::cout << "testProgramCall : b = " << b << std::endl; |
| 79 | 1 | return true; | |
| 80 | 1 | } | |
| 81 | |||
| 82 | 1 | int main(int argc, char **argv){ | |
| 83 | 1 | bool b(true); | |
| 84 | 1 | b &= testBaseProgramCall(); | |
| 85 | 1 | b &= testProgramCall(); | |
| 86 | 1 | std::cout << "final : b = " << b << std::endl; | |
| 87 | 1 | return b - 1; | |
| 88 | } | ||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 |