PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
main.cpp File Reference
#include "data_stream_assert.h"
#include "Shadok.h"
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

bool checkEqualityConst (const Shadok &s1, const Shadok &s2)
 Check the shadok equality as constant. More...
 
int main (int argc, char **argv)
 
void testShadok ()
 Some basic Shadok test. More...
 
void testShadokFile ()
 Test the Shadok message. More...
 
void testShadokMessage ()
 Test the Shadok message. More...
 
void testShadokSize ()
 Test the Shadok size. More...
 

Function Documentation

◆ checkEqualityConst()

bool checkEqualityConst ( const Shadok s1,
const Shadok s2 
)

Check the shadok equality as constant.

Parameters
s1: Shadok to be checked
s2: Shadok to be checked
Returns
true if the two Shadok are equal, false otherwise

Definition at line 61 of file main.cpp.

61  {
62  return s1.getName() == s2.getName() && s1.getAge() == s2.getAge();
63 }

References Shadok::getAge(), and Shadok::getName().

Referenced by testShadok().

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

75  {
79  testShadok();
80  return 0;
81 }

References testShadok(), testShadokFile(), testShadokMessage(), and testShadokSize().

+ Here is the call graph for this function:

◆ testShadok()

void testShadok ( )

Some basic Shadok test.

Definition at line 66 of file main.cpp.

66  {
67  Shadok s;
68  Shadok p(s);
69  Shadok q;
70  q = s;
71  data_stream_assert(s.getAge() == q.getAge());
73 }

References checkEqualityConst(), data_stream_assert, and Shadok::getAge().

Referenced by main().

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

◆ testShadokFile()

void testShadokFile ( )

Test the Shadok message.

Load shadok from message

Definition at line 40 of file main.cpp.

40  {
41  Shadok s;
42  s.setAge(3);
43  s.setName("Shadoko");
44 
45  std::string fileName("shadok.data");
46  data_save(fileName, s);
47 
49  Shadok out;
50  data_load(fileName, out);
51 
52  data_stream_assert(s.getAge() == out.getAge());
53  data_stream_assert(s.getName() == out.getName());
54 }

References data_load(), data_save(), data_stream_assert, Shadok::getAge(), Shadok::getName(), Shadok::setAge(), and Shadok::setName().

Referenced by main().

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

◆ testShadokMessage()

void testShadokMessage ( )

Test the Shadok message.

Load shadok from message

Definition at line 21 of file main.cpp.

21  {
22  Shadok s;
23  s.setAge(3);
24  s.setName("Shadoko");
25 
26  std::vector<char> messageIn(data_size(s));
27  char* iter = (char*)messageIn.data();
28  data_message_save(iter, s);
29 
31  Shadok out;
32  char* iterOut = (char*)messageIn.data();
33  data_message_load(iterOut, out);
34 
35  data_stream_assert(s.getAge() == out.getAge());
36  data_stream_assert(s.getName() == out.getName());
37 }

References data_message_load(), data_message_save(), data_size(), data_stream_assert, Shadok::getAge(), Shadok::getName(), Shadok::setAge(), and Shadok::setName().

Referenced by main().

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

◆ testShadokSize()

void testShadokSize ( )

Test the Shadok size.

Definition at line 11 of file main.cpp.

11  {
12  Shadok s;
13  s.setAge(3);
14  s.setName("Shadoko");
15 
16  size_t shadokSize(data_size(s));
17  data_stream_assert(shadokSize == 19lu);
18 }

References data_size(), data_stream_assert, Shadok::setAge(), and Shadok::setName().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
data_stream_assert
#define data_stream_assert(isOk)
Definition: data_stream_assert.h:17
Shadok::getAge
int getAge() const
Get the age of the Shadok.
Definition: Shadok.cpp:49
checkEqualityConst
bool checkEqualityConst(const Shadok &s1, const Shadok &s2)
Check the shadok equality as constant.
Definition: main.cpp:61
data_size
size_t data_size(T &data)
Get size of data.
Definition: data_size.h:17
Shadok::setAge
void setAge(int age)
Set the age of the Shadok.
Definition: Shadok.cpp:39
Shadok::getName
const std::string & getName() const
Get the name of the Shadok.
Definition: Shadok.cpp:59
testShadok
void testShadok()
Some basic Shadok test.
Definition: main.cpp:66
data_save
bool data_save(FILE *iter, const T &data)
Save data in a message.
Definition: data_file.h:18
data_message_save
bool data_message_save(Stream &iter, T &data)
Save data in a message.
Definition: data_message.h:18
testShadokMessage
void testShadokMessage()
Test the Shadok message.
Definition: main.cpp:21
data_load
bool data_load(FILE *iter, T &data)
Load data from a message.
Definition: data_file.h:39
Shadok
test class for the data_stream automatic api
Definition: Shadok.h:13
testShadokFile
void testShadokFile()
Test the Shadok message.
Definition: main.cpp:40
Shadok::setName
void setName(const std::string &name)
Set the name of the Shadok.
Definition: Shadok.cpp:44
data_message_load
bool data_message_load(char *&iter, T &data)
Load data from a message.
Definition: data_message.h:60
testShadokSize
void testShadokSize()
Test the Shadok size.
Definition: main.cpp:11