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 dependency graph for main.cpp:

Go to the source code of this file.

Functions

template<typename T >
bool checkPhoenixCheck (T val, T valSame, T valDifferent)
 Check the phoenix_check. More...
 
int main (int argc, char **argv)
 
void testCheckFileContent ()
 Check the file content. More...
 
void testCheckList ()
 Check the list. More...
 
void testCheckVector ()
 Check the vector. More...
 
void testIsOk ()
 Test the string filename function. More...
 

Function Documentation

◆ checkPhoenixCheck()

template<typename T >
bool checkPhoenixCheck ( val,
valSame,
valDifferent 
)

Check the phoenix_check.

Parameters
val: value
valSame: same value
valDifferent: different value
Returns
true on success, false otherwise

Definition at line 19 of file main.cpp.

19  {
20  bool b(true);
21  b &= phoenix_check("checkPhoenixCheck : OK : ", val, valSame);
22  b &= !phoenix_check("checkPhoenixCheck : FAIL : ", val, valDifferent);
23  return b;
24 }

References phoenix_check().

+ Here is the call graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 102 of file main.cpp.

102  {
103  testIsOk();
104  testCheckVector();
105  testCheckList();
107  return 0;
108 }

References testCheckFileContent(), testCheckList(), testCheckVector(), and testIsOk().

+ Here is the call graph for this function:

◆ testCheckFileContent()

void testCheckFileContent ( )

Check the file content.

Definition at line 98 of file main.cpp.

98  {
99  phoenix_assert(phoenix_check_fileContent("Check file content", "", ""));
100 }

References phoenix_assert, and phoenix_check_fileContent().

Referenced by main().

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

◆ testCheckList()

void testCheckList ( )

Check the list.

Definition at line 73 of file main.cpp.

73  {
74  std::list<std::string> vecVal, vecValShort, vecValLong, vecEmpty;
75  vecVal.push_back("1");
76  vecVal.push_back("2");
77  vecVal.push_back("3");
78 
79  vecValShort.push_back("1");
80  vecValShort.push_back("2");
81 
82  vecValLong.push_back("1");
83  vecValLong.push_back("2");
84  vecValLong.push_back("3");
85  vecValLong.push_back("4");
86 
87  phoenix_assert(phoenix_check("List equal", vecVal, vecVal));
88  phoenix_assert(!phoenix_check("List equal empty left", vecEmpty, vecVal));
89  phoenix_assert(!phoenix_check("List equal empty right", vecVal, vecEmpty));
90  phoenix_assert(phoenix_check("List empty", vecEmpty, vecEmpty));
91  phoenix_assert(!phoenix_check("List equal short left", vecValShort, vecVal));
92  phoenix_assert(!phoenix_check("List equal short right", vecVal, vecValShort));
93  phoenix_assert(!phoenix_check("List equal long left", vecValLong, vecVal));
94  phoenix_assert(!phoenix_check("List equal long right", vecVal, vecValLong));
95 }

References phoenix_assert, and phoenix_check().

Referenced by main().

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

◆ testCheckVector()

void testCheckVector ( )

Check the vector.

Definition at line 48 of file main.cpp.

48  {
49  std::vector<std::string> vecVal, vecValShort, vecValLong, vecEmpty;
50  vecVal.push_back("1");
51  vecVal.push_back("2");
52  vecVal.push_back("3");
53 
54  vecValShort.push_back("1");
55  vecValShort.push_back("2");
56 
57  vecValLong.push_back("1");
58  vecValLong.push_back("2");
59  vecValLong.push_back("3");
60  vecValLong.push_back("4");
61 
62  phoenix_assert(phoenix_check("Vec equal", vecVal, vecVal));
63  phoenix_assert(!phoenix_check("Vec equal empty left", vecEmpty, vecVal));
64  phoenix_assert(!phoenix_check("Vec equal empty right", vecVal, vecEmpty));
65  phoenix_assert(phoenix_check("Vec empty", vecEmpty, vecEmpty));
66  phoenix_assert(!phoenix_check("Vec equal short left", vecValShort, vecVal));
67  phoenix_assert(!phoenix_check("Vec equal short right", vecVal, vecValShort));
68  phoenix_assert(!phoenix_check("Vec equal long left", vecValLong, vecVal));
69  phoenix_assert(!phoenix_check("Vec equal long right", vecVal, vecValLong));
70 }

References phoenix_assert, and phoenix_check().

Referenced by main().

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

◆ testIsOk()

void testIsOk ( )

Test the string filename function.

Definition at line 27 of file main.cpp.

27  {
28  std::cout << "testIsOk : OK => " << phoenix_isOk(true) << std::endl;
29  std::cout << "testIsOk : FAIL => " << phoenix_isOk(false) << std::endl;
30 
31  phoenix_assert(phoenix_check("testIsOk : OK : ", phoenix_isOk(true), std::string("\033[32mOK\033[0m")));
32  phoenix_assert(phoenix_check("testIsOk : FAIL : ", phoenix_isOk(false), std::string("\033[31mFAIL\033[0m")));
33  phoenix_assert(phoenix_check("testIsOk : OK : ", phoenix_isOk(true), "\033[32mOK\033[0m"));
34  phoenix_assert(phoenix_check("testIsOk : FAIL : ", phoenix_isOk(false), "\033[31mFAIL\033[0m"));
35  phoenix_assert(checkPhoenixCheck<int>(42, 42, 28));
36  phoenix_assert(checkPhoenixCheck<short>(42, 42, 28));
37  phoenix_assert(checkPhoenixCheck<long>(42, 42, 28));
38  phoenix_assert(checkPhoenixCheck<char>(42, 42, 43));
39  phoenix_assert(checkPhoenixCheck<unsigned int>(42, 42, 28));
40  phoenix_assert(checkPhoenixCheck<unsigned short>(42, 42, 28));
41  phoenix_assert(checkPhoenixCheck<unsigned long>(42, 42, 28));
42  phoenix_assert(checkPhoenixCheck<unsigned char>(42, 42, 43));
43  phoenix_assert(checkPhoenixCheck<float>(42, 42, 28));
44  phoenix_assert(checkPhoenixCheck<double>(42, 42, 28));
45 }

References phoenix_assert, phoenix_check(), and phoenix_isOk().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
testIsOk
void testIsOk()
Test the string filename function.
Definition: main.cpp:27
testCheckFileContent
void testCheckFileContent()
Check the file content.
Definition: main.cpp:98
phoenix_check_fileContent
bool phoenix_check_fileContent(const std::string &testName, const std::string &fileName, const std::string &expectedContent)
Check the content of a file.
Definition: phoenix_check.cpp:71
testCheckList
void testCheckList()
Check the list.
Definition: main.cpp:73
testCheckVector
void testCheckVector()
Check the vector.
Definition: main.cpp:48
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
phoenix_isOk
std::string phoenix_isOk(bool b)
Print OK or FAIL depending on the given boolean.
Definition: phoenix_isOk.cpp:14