GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
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 <vector> |
||
10 |
#include "phoenix_assert.h" |
||
11 |
#include "string_filename.h" |
||
12 |
#include "string_system.h" |
||
13 |
|||
14 |
///Test the string system function |
||
15 |
1 |
void testStringSystem(){ |
|
16 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(getProgramDirectory() != ""); |
17 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(getProgramLocation() != ""); |
18 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(getProgramPrefix() != ""); |
19 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(getFileModificationTime("Makefile") != 0l); |
20 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(getFileModificationTime("") == -1l); |
21 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(getFileModificationTime("SomeInexistingFile") == -1l); |
22 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(getHomeDir() != ""); |
23 |
|||
24 |
2 |
std::list<std::string> listFile; |
|
25 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(getListAllFileInDir(listFile, "./")); |
26 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(getListFileInDir(listFile, "./", "\\.cmake")); |
27 |
✓✓ | 1 |
getListFileInCurrentDir(listFile, "\\.cmake"); |
28 |
✓✓✓✓ |
1 |
phoenix_assert(listFile.size() != 0lu); |
29 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(!isStringMatchRegex("", "")); |
30 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(!isStringMatchRegex("es", "")); |
31 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(!isStringMatchRegex("", "egzg")); |
32 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(!isStringMatchRegex("thing.txt", "*.*")); |
33 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(isStringMatchRegex("file.txt", "\\.txt")); |
34 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(createDirIfNotExist("NewDirectory")); |
35 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(createDirIfNotExist("NewDirectory")); |
36 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(saveFileContent("NewDirectory/newFile.txt", "some content of the new file")); |
37 |
2 |
std::vector<std::string> vecFile1; |
|
38 |
✓✓ | 1 |
time_t lastTime = getFileInDirPerTime(vecFile1, "NewDirectory/"); |
39 |
✓✓✓✓ |
1 |
phoenix_assert(vecFile1.size() == 1lu); |
40 |
2 |
std::vector<std::string> vecFile2; |
|
41 |
✓✓ | 1 |
time_t lastTime2 = getFileInDirPerTime(vecFile2, "NewDirectory/", lastTime); |
42 |
✓✓✓✓ |
1 |
phoenix_assert(lastTime2 == lastTime); |
43 |
✓✓✓✓ |
1 |
phoenix_assert(vecFile2.size() == 0lu); |
44 |
✓ | 2 |
std::string currentNode(getCurrentNodeName()); |
45 |
✓✓✓✓ ✓ |
1 |
phoenix_assert(currentNode != ""); |
46 |
|||
47 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(phoenix_getenv("UNEXISTING_VARIABLE") == ""); |
48 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(phoenix_setenv("SomeExistingVariable", "42")); |
49 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(phoenix_getenv("SomeExistingVariable") == "42"); |
50 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(phoenix_unsetenv("SomeExistingVariable")); |
51 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(phoenix_chmod("Makefile")); |
52 |
✓✓✓✓ ✓✓ |
1 |
phoenix_assert(!phoenix_chmod("UnexistingFile")); |
53 |
|||
54 |
✓✓ | 2 |
std::vector<std::string> vecFoundFile = phoenix_find("./*.cmake"); |
55 |
✓✓✓✓ |
1 |
phoenix_assert(vecFoundFile.size() != 0lu); |
56 |
1 |
} |
|
57 |
|||
58 |
1 |
int main(int argc, char** argv){ |
|
59 |
1 |
std::list<std::string> listArg; |
|
60 |
✓ | 1 |
makeListArgument(listArg, argc, argv); |
61 |
✓✓✓✓ |
1 |
phoenix_assert(listArg.size() != 0lu); |
62 |
✓ | 1 |
testStringSystem(); |
63 |
1 |
return 0; |
|
64 |
} |
||
65 |
|||
66 |
Generated by: GCOVR (Version 4.2) |