PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
main.cpp File Reference
#include <iostream>
#include <vector>
#include "phoenix_assert.h"
#include "string_system.h"
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 
void testPoenixPOpen ()
 Test the phoenix popen function. More...
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 39 of file main.cpp.

39  {
41  return 0;
42 }

References testPoenixPOpen().

+ Here is the call graph for this function:

◆ testPoenixPOpen()

void testPoenixPOpen ( )

Test the phoenix popen function.

Definition at line 14 of file main.cpp.

14  {
15  std::string resCmd1(phoenix_popen("echo \"test command\""));
16  std::cout << "testPoenixPOpen : resCmd1 = '" << resCmd1 << "'" << std::endl;
17  phoenix_assert(resCmd1 == "test command\n");
18  phoenix_assert(phoenix_popen("") == "");
19  std::string resCmd3(phoenix_popen("someUnexistingCommad"));
20  std::cout << "testPoenixPOpen : 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  std::string resEmptyCmd("");
26  int exitStatus2 = phoenix_popen(resEmptyCmd, "");
27  phoenix_assert(resEmptyCmd == "");
28  phoenix_assert(exitStatus2 == -1);
29  std::string resUnexistingCmd("");
30  int exitStatus3 = phoenix_popen(resUnexistingCmd, "someUnexistingCommad");
31  phoenix_assert(resUnexistingCmd == "");
32  phoenix_assert(exitStatus3 == 32512);
33  phoenix_assert(phoenix_popen("command.log", "echo \"test command\"", true));
34  phoenix_assert(phoenix_popen("command.log", "echo \"test command\"", false));
35  phoenix_assert(!phoenix_popen("command_unexistingCommand.log", "someUnexistingCommand", true));
36  phoenix_assert(!phoenix_popen("command_unexistingCommand.log", "someUnexistingCommand", false));
37 }

References phoenix_assert, and phoenix_popen().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
phoenix_popen
std::string phoenix_popen(const std::string &command)
Execute the given command and returns the output of this command.
Definition: string_system.cpp:341
testPoenixPOpen
void testPoenixPOpen()
Test the phoenix popen function.
Definition: main.cpp:14
phoenix_assert
#define phoenix_assert(isOk)
Definition: phoenix_assert.h:19