PhoenixGenerator  2.0.0
Set of tools to generate code
main.cpp
Go to the documentation of this file.
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 "phoenix_system.h"
12 
15  PString resCmd1(phoenix_popen("echo \"test command\""));
16  std::cout << "testPhoenixPOpen : resCmd1 = '" << resCmd1 << "'" << std::endl;
17  phoenix_assert(resCmd1 == "test command\n");
18  phoenix_assert(phoenix_popen("") == "");
19  PString resCmd3(phoenix_popen("someUnexistingCommad"));
20  std::cout << "testPhoenixPOpen : resCmd3 = '" << resCmd3 << "'" << std::endl;
21  phoenix_assert(resCmd3 == "\0");
22  int exitStatus1 = phoenix_popen(resCmd1, "echo \"test command\"");
23  phoenix_assert(resCmd1 == "test command\n");
24  phoenix_assert(exitStatus1 == 0);
25  PString resEmptyCmd("");
26  int exitStatus2 = phoenix_popen(resEmptyCmd, "");
27  phoenix_assert(resEmptyCmd == "");
28  phoenix_assert(exitStatus2 == -1);
29  PString resUnexistingCmd("");
30  int exitStatus3 = phoenix_popen(resUnexistingCmd, "someUnexistingCommad");
31  phoenix_assert(resUnexistingCmd == "");
32  phoenix_assert(exitStatus3 == 32512);
33  phoenix_assert(phoenix_popen(PPath("command.log"), "echo \"test command\"", true));
34  phoenix_assert(phoenix_popen(PPath("command.log"), "echo \"test command\"", false));
35  phoenix_assert(!phoenix_popen(PPath("command_unexistingCommand.log"), "someUnexistingCommand", true));
36  phoenix_assert(!phoenix_popen(PPath("command_unexistingCommand.log"), "someUnexistingCommand", false));
37 }
38 
39 int main(int argc, char** argv){
41  return 0;
42 }
43 
44 
int main(int argc, char **argv)
Definition: main.cpp:19
void testPhoenixPOpen()
Test the phoenix popen function.
Definition: main.cpp:14
Path of a directory or a file.
Definition: PPath.h:17
Extends the std::string.
Definition: PString.h:16
#define phoenix_assert(isOk)
PString phoenix_popen(const PString &command)
Execute the given command and returns the output of this command.