PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
main.cpp File Reference
#include <iostream>
#include "phoenix_assert.h"
#include "phoenix_check.h"
#include "phoenix_system.h"
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

bool checkOptionCompletion (const PString &program, const PString &partialOption, const PString &prevCursorOption, const PString &cursorOption, const PString &expectedResult)
 Check the option completion of a program. More...
 
int main (int argc, char **argv)
 
void testCompletion ()
 Test the completion of the option. More...
 

Function Documentation

◆ checkOptionCompletion()

bool checkOptionCompletion ( const PString program,
const PString partialOption,
const PString prevCursorOption,
const PString cursorOption,
const PString expectedResult 
)

Check the option completion of a program.

Parameters
program: program to be tested
partialOption: partial typed option
cursorOption: option of the cursor
prevCursorOption: previous cursor option
expectedResult: expected completion result
Returns
true on success, false otherwise

Definition at line 21 of file main.cpp.

23 {
24  PString command(program + " __bashcompletionmode=\""+cursorOption+"\" __bashcompletionmodeprev=\""+prevCursorOption+"\" prgName " + partialOption);
25  PString resultCmd(phoenix_popen(command));
26 
27  bool b(phoenix_check("checkOptionCompletion cmd("+command+")", resultCmd, expectedResult));
28  return b;
29 }
Extends the std::string.
Definition: PString.h:16
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.
PString phoenix_popen(const PString &command)
Execute the given command and returns the output of this command.

References phoenix_check(), and phoenix_popen().

Referenced by testCompletion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 52 of file main.cpp.

52  {
54  return 0;
55 }
void testCompletion()
Test the completion of the option.
Definition: main.cpp:32

References testCompletion().

+ Here is the call graph for this function:

◆ testCompletion()

void testCompletion ( )

Test the completion of the option.

Definition at line 32 of file main.cpp.

32  {
33  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_INT, "", "", "", "--value -n --help -h --version -v \n"));
34  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_INT, "-", "", "-", "--value -n --help -h --version -v \n"));
35  //Here we expect mostly '--value --help --version'
36  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_INT, "--", "", "--", "--value --help --version \n"));
37  //Here we expect mostly '--value --version'
38  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_INT, "--v", "", "--v", "--value --version \n"));
39  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_INT, "--value", "--value", "", "INT\n"));
40  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_INT, "--value=42", "", "", "--help -h --version -v \n"));
41 
42  //Let's test the vector of possible values
43  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_VEC_POSSIBLE_VALUE, "", "", "", "--project -p --help -h --version -v \n"));
44  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_VEC_POSSIBLE_VALUE, "--project", "--project", "", "test othervalue lastpossibility\n"));
45 
46  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_VEC_POSSIBLE_VALUE, "--project", "--project", "oth", "othervalue\n"));
47 
48  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_VEC_POSSIBLE_VALUE, "-p", "-p", "", "test othervalue lastpossibility\n"));
49  phoenix_assert(checkOptionCompletion(PROGRAM_OPTION_COMPLETION_VEC_POSSIBLE_VALUE, "--project=test", "", "", "--help -h --version -v \n"));
50 }
#define phoenix_assert(isOk)
bool checkOptionCompletion(const PString &program, const PString &partialOption, const PString &prevCursorOption, const PString &cursorOption, const PString &expectedResult)
Check the option completion of a program.
Definition: main.cpp:21

References checkOptionCompletion(), and phoenix_assert.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: