1 |
|
|
|
2 |
|
|
/*************************************** |
3 |
|
|
Auteur : Pierre Aubert |
4 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
5 |
|
|
Licence : CeCILL-C |
6 |
|
|
****************************************/ |
7 |
|
|
|
8 |
|
|
#include "phoenix_check.h" |
9 |
|
|
#include "file_utils.h" |
10 |
|
|
|
11 |
|
|
///Check the file utils |
12 |
|
|
/** @return true on success, false otherwise |
13 |
|
|
*/ |
14 |
|
1 |
bool testFileUtils(){ |
15 |
|
1 |
bool b(true); |
16 |
|
|
|
17 |
✓✓ |
1 |
b &= getFileName("someDir/with/someFile.txt") == "someFile.txt"; |
18 |
✓✓ |
1 |
b &= getFileName("someDir/with/") == ""; |
19 |
✓✓ |
1 |
b &= getFileName("") == ""; |
20 |
|
|
|
21 |
✓✓ |
1 |
b &= getFileContent("SomeInexistingFile") == ""; |
22 |
✓✓ |
1 |
b &= getFileContent("Makefile") != ""; |
23 |
|
|
|
24 |
✓✓✓ |
1 |
b &= saveFileContent("file.txt", "content"); |
25 |
✓✓✓ |
1 |
b &= saveFileContent("file2.txt", ""); |
26 |
✓✓✓ |
1 |
b &= !saveFileContent("", "whatever"); |
27 |
✓✓ |
1 |
phoenix_functionOk("testFileUtils", b); |
28 |
|
1 |
return b; |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
|
32 |
|
1 |
int main(int argc, char** argv){ |
33 |
|
1 |
bool b(testFileUtils()); |
34 |
✓✓ |
1 |
phoenix_functionOk("final", b); |
35 |
|
1 |
return b - 1; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
|