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

Go to the source code of this file.

Functions

bool checkEraseFirstChars (const std::string &testName, const std::string &strExpr, const std::string &strReference)
 Check the erase first chars. More...
 
bool checkEraseFirstLastChars (const std::string &testName, const std::string &strExpr, const std::string &strReference)
 Check the erase first last chars. More...
 
bool checkEraseFirstLastCharsVector (const std::string &testName, const std::string &strExpr, const std::string &strReference)
 Check the erase first last chars. More...
 
bool checkEraseLastChars (const std::string &testName, const std::string &strExpr, const std::string &strReference)
 Check the erase last chars. More...
 
int main (int argc, char **argv)
 
void testBaseEraseFirstChars ()
 Test string erase first chars. More...
 
void testBaseEraseFirstLastChars ()
 Test string erase first last chars. More...
 
void testBaseEraseLastChars ()
 Test string erase last chars. More...
 

Function Documentation

◆ checkEraseFirstChars()

bool checkEraseFirstChars ( const std::string &  testName,
const std::string &  strExpr,
const std::string &  strReference 
)

Check the erase first chars.

Parameters
testName: name of the test
strExpr: string to be parsed to get a MathExpr
strReference: reference string
Returns
true is both strings are equal, false otherwise

Definition at line 19 of file main.cpp.

19  {
20  std::string strErase(eraseFirstCharsInStr(strExpr, " \t\n"));
21  return phoenix_check(testName + "("+strExpr+")", strErase, strReference);
22 }

References eraseFirstCharsInStr(), and phoenix_check().

Referenced by testBaseEraseFirstChars().

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

◆ checkEraseFirstLastChars()

bool checkEraseFirstLastChars ( const std::string &  testName,
const std::string &  strExpr,
const std::string &  strReference 
)

Check the erase first last chars.

Parameters
testName: name of the test
strExpr: string to be parsed to get a MathExpr
strReference: reference string
Returns
true is both strings are equal, false otherwise

Definition at line 41 of file main.cpp.

41  {
42  std::string strErase(eraseFirstLastChars(strExpr, " \t\n"));
43  return phoenix_check(testName + "("+strExpr+")", strErase, strReference);
44 }

References eraseFirstLastChars(), and phoenix_check().

Referenced by testBaseEraseFirstLastChars().

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

◆ checkEraseFirstLastCharsVector()

bool checkEraseFirstLastCharsVector ( const std::string &  testName,
const std::string &  strExpr,
const std::string &  strReference 
)

Check the erase first last chars.

Parameters
testName: name of the test
strExpr: string to be parsed to get a MathExpr
strReference: reference string
Returns
true is both strings are equal, false otherwise

Definition at line 52 of file main.cpp.

52  {
53  std::vector<std::string> vecStrExpr;
54  vecStrExpr.push_back(strExpr);
55  std::vector<std::string> strErase(eraseFirstLastChars(vecStrExpr, " \t\n"));
56  return phoenix_check(testName + "("+strExpr+")", strErase.front(), strReference);
57 }

References eraseFirstLastChars(), and phoenix_check().

Referenced by testBaseEraseFirstLastChars().

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

◆ checkEraseLastChars()

bool checkEraseLastChars ( const std::string &  testName,
const std::string &  strExpr,
const std::string &  strReference 
)

Check the erase last chars.

Parameters
testName: name of the test
strExpr: string to be parsed to get a MathExpr
strReference: reference string
Returns
true is both strings are equal, false otherwise

Definition at line 30 of file main.cpp.

30  {
31  std::string strErase(eraseLastCharsInStr(strExpr, " \t\n"));
32  return phoenix_check(testName + "("+strExpr+")", strErase, strReference);
33 }

References eraseLastCharsInStr(), and phoenix_check().

Referenced by testBaseEraseLastChars().

+ 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 84 of file main.cpp.

84  {
88  return 0;
89 }

References testBaseEraseFirstChars(), testBaseEraseFirstLastChars(), and testBaseEraseLastChars().

+ Here is the call graph for this function:

◆ testBaseEraseFirstChars()

void testBaseEraseFirstChars ( )

Test string erase first chars.

Definition at line 60 of file main.cpp.

60  {
61  phoenix_assert(checkEraseFirstChars("Erase first chars 1", "one thing", "one thing"));
62  phoenix_assert(checkEraseFirstChars("Erase first chars 2", " one thing", "one thing"));
63  phoenix_assert(checkEraseFirstChars("Erase first chars 3", "one thing ", "one thing "));
64  phoenix_assert(checkEraseFirstChars("Erase first chars 4", " one thing ", "one thing "));
65 }

References checkEraseFirstChars(), and phoenix_assert.

Referenced by main().

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

◆ testBaseEraseFirstLastChars()

void testBaseEraseFirstLastChars ( )

Test string erase first last chars.

Definition at line 76 of file main.cpp.

76  {
77  phoenix_assert(checkEraseFirstLastChars("Erase first last chars 1", "one thing", "one thing"));
78  phoenix_assert(checkEraseFirstLastChars("Erase first last chars 2", " one thing", "one thing"));
79  phoenix_assert(checkEraseFirstLastChars("Erase first last chars 3", "one thing ", "one thing"));
80  phoenix_assert(checkEraseFirstLastChars("Erase first last chars 4", " one thing ", "one thing"));
81  phoenix_assert(checkEraseFirstLastCharsVector("Erase first last chars 4", " one thing ", "one thing"));
82 }

References checkEraseFirstLastChars(), checkEraseFirstLastCharsVector(), and phoenix_assert.

Referenced by main().

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

◆ testBaseEraseLastChars()

void testBaseEraseLastChars ( )

Test string erase last chars.

Definition at line 68 of file main.cpp.

68  {
69  phoenix_assert(checkEraseLastChars("Erase last chars 1", "one thing", "one thing"));
70  phoenix_assert(checkEraseLastChars("Erase last chars 2", " one thing", " one thing"));
71  phoenix_assert(checkEraseLastChars("Erase last chars 3", "one thing ", "one thing"));
72  phoenix_assert(checkEraseLastChars("Erase last chars 4", " one thing ", " one thing"));
73 }

References checkEraseLastChars(), and phoenix_assert.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
checkEraseFirstLastChars
bool checkEraseFirstLastChars(const std::string &testName, const std::string &strExpr, const std::string &strReference)
Check the erase first last chars.
Definition: main.cpp:41
testBaseEraseLastChars
void testBaseEraseLastChars()
Test string erase last chars.
Definition: main.cpp:68
testBaseEraseFirstChars
void testBaseEraseFirstChars()
Test string erase first chars.
Definition: main.cpp:60
eraseFirstCharsInStr
std::string eraseFirstCharsInStr(const std::string &str, const std::string &chars)
Erase first char in a string.
Definition: string_function.cpp:77
checkEraseLastChars
bool checkEraseLastChars(const std::string &testName, const std::string &strExpr, const std::string &strReference)
Check the erase last chars.
Definition: main.cpp:30
checkEraseFirstLastCharsVector
bool checkEraseFirstLastCharsVector(const std::string &testName, const std::string &strExpr, const std::string &strReference)
Check the erase first last chars.
Definition: main.cpp:52
checkEraseFirstChars
bool checkEraseFirstChars(const std::string &testName, const std::string &strExpr, const std::string &strReference)
Check the erase first chars.
Definition: main.cpp:19
testBaseEraseFirstLastChars
void testBaseEraseFirstLastChars()
Test string erase first last chars.
Definition: main.cpp:76
phoenix_check
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.
Definition: phoenix_check.cpp:17
phoenix_assert
#define phoenix_assert(isOk)
Definition: phoenix_assert.h:19
eraseLastCharsInStr
std::string eraseLastCharsInStr(const std::string &str, const std::string &chars)
Erase first and last char in a string.
Definition: string_function.cpp:97
eraseFirstLastChars
std::string eraseFirstLastChars(const std::string &str, const std::string &chars)
Erase first and last char in a string.
Definition: string_function.cpp:122