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 "PString.h"
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

bool checkString (const std::string &testName, const std::string &strValue, const std::string &strReference)
 Check string lower expression. More...
 
int main (int argc, char **argv)
 
void testPString ()
 Test the is lower/upper case. More...
 

Function Documentation

◆ checkString()

bool checkString ( const std::string &  testName,
const std::string &  strValue,
const std::string &  strReference 
)

Check string lower expression.

Parameters
testName: name of the test
strValue: string to be tested
strReference: reference string
Returns
true is both strings are equal, false otherwise

Definition at line 20 of file main.cpp.

20  {
21  return phoenix_check(testName, strValue, strReference);
22 }

References phoenix_check().

+ Here is the call graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 105 of file main.cpp.

105  {
106  testPString();
107  return 0;
108 }

References testPString().

+ Here is the call graph for this function:

◆ testPString()

void testPString ( )

Test the is lower/upper case.

Definition at line 25 of file main.cpp.

25  {
26  PString baseStr("baseString");
27  phoenix_assert(checkString("Test constructor", baseStr, "baseString"));
28  PString checkEqual;
29  checkEqual = baseStr;
30  phoenix_assert(checkString("Test equal", checkEqual, "baseString"));
31 
32  PString copyString(baseStr);
33  phoenix_assert(checkString("Test copy constructor", copyString, "baseString"));
34  PString equalOperatorStr;
35  equalOperatorStr = baseStr;
36  phoenix_assert(checkString("Test equal operator str", equalOperatorStr, "baseString"));
37 
38  PString equalOperatorFluxStr;
39  equalOperatorFluxStr = baseStr;
40  phoenix_assert(checkString("Test << operator str", equalOperatorFluxStr, "baseString"));
41 
42  baseStr += " end";
43  phoenix_assert(checkString("Test += string", baseStr, "baseString end"));
44 
45  PString valDouble;
46  valDouble = 42.0;
47  phoenix_assert(checkString("Test equal operator double", valDouble, "42"));
48 
49  PString valFloat;
50  valFloat = 42.0f;
51  phoenix_assert(checkString("Test equal operator float", valFloat, "42"));
52 
53  PString valDoubleFlux;
54  valDoubleFlux << 42.0;
55  phoenix_assert(checkString("Test << operator double", valDoubleFlux, "42"));
56 
57  PString valFloatFlux;
58  valFloatFlux << 42.0f;
59  phoenix_assert(checkString("Test << operator float", valFloatFlux, "42"));
60 
61  valDouble += 3.14;
62  phoenix_assert(checkString("Test += operator double", valDouble, "423.14"));
63 
64  valFloat += 3.14f;
65  phoenix_assert(checkString("Test += operator float", valFloat, "423.14"));
66 
67  PString resAdd = valDouble + valFloat;
68  phoenix_assert(checkString("Test + operator PString", resAdd, "423.14423.14"));
69 
70  PString resAddDouble;
71  resAddDouble = PString("double ") + 3.14;
72  phoenix_assert(checkString("Test + operator double", resAddDouble, "double 3.14"));
73 
74  PString resAddFloat;
75  resAddFloat = PString("float ") + 3.14;
76  phoenix_assert(checkString("Test + operator float", resAddFloat, "float 3.14"));
77 
78  PString strA("str1"), strB("str2"), resResAB, resFluxAB;
79  resResAB = strA + strB;
80  phoenix_assert(checkString("Test + operator PString", resResAB, "str1str2"));
81  resFluxAB << strA << strB;
82  phoenix_assert(checkString("Test << operator PString", resFluxAB, "str1str2"));
83 
84  PString strAddStr("Some string");
85  strAddStr += " other string";
86  phoenix_assert(checkString("Test += operator std::string", strAddStr, "Some string other string"));
87 
88  PString strAddFluxStr("Some string");
89  strAddFluxStr << " other string";
90  phoenix_assert(checkString("Test << operator std::string", strAddFluxStr, "Some string other string"));
91 
92  PString strFlux;
93  strFlux << strAddFluxStr;
94  phoenix_assert(checkString("Test << operator PString", strFlux, "Some string other string"));
95 
96  strFlux += std::string(" and the end");
97  phoenix_assert(checkString("Test += operator std::string", strFlux, "Some string other string and the end"));
98 
99  strFlux << std::string(".");
100  phoenix_assert(checkString("Test += operator std::string", strFlux, "Some string other string and the end."));
101 
102  strA << (strFlux << strAddFluxStr);
103 }

References checkString(), and phoenix_assert.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
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
PString
Extends the std::string.
Definition: PString.h:17
phoenix_assert
#define phoenix_assert(isOk)
Definition: phoenix_assert.h:19
testPString
void testPString()
Test the is lower/upper case.
Definition: main.cpp:25
checkString
bool checkString(const std::string &testName, const std::string &strValue, const std::string &strReference)
Check string lower expression.
Definition: main.cpp:21