PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
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 }
const std::string & getName() const
Get the name of the Shadok.
Definition: Shadok.cpp:59
int getAge() const
Get the age of the Shadok.
Definition: Shadok.cpp:49

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 }
void testShadok()
Some basic Shadok test.
Definition: main.cpp:66
void testShadokMessage()
Test the Shadok message.
Definition: main.cpp:21
void testShadokFile()
Test the Shadok message.
Definition: main.cpp:40
void testShadokSize()
Test the Shadok size.
Definition: main.cpp:11

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 }
test class for the data_stream automatic api
Definition: Shadok.h:13
#define data_stream_assert(isOk)
bool checkEqualityConst(const Shadok &s1, const Shadok &s2)
Check the shadok equality as constant.
Definition: main.cpp:61

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 }
void setAge(int age)
Set the age of the Shadok.
Definition: Shadok.cpp:39
void setName(const std::string &name)
Set the name of the Shadok.
Definition: Shadok.cpp:44
bool data_load(FILE *iter, T &data)
Load data from a message.
Definition: data_file.h:39
bool data_save(FILE *iter, const T &data)
Save data in a message.
Definition: data_file.h:18

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  DataStreamMsg messageIn(data_size(s));
27  DataStreamIter iter = (DataStreamIter)messageIn.data();
29 
31  Shadok out;
32  DataStreamIter iterOut = (DataStreamIter)messageIn.data();
34 
35  data_stream_assert(s.getAge() == out.getAge());
36  data_stream_assert(s.getName() == out.getName());
37 }
bool data_message_save(DataStreamIter &iter, T &data)
Save data in a message.
Definition: data_message.h:18
bool data_message_load(DataStreamIter &iter, T &data)
Load data from a message.
Definition: data_message.h:60
size_t data_size(T &data)
Get size of data.
Definition: data_size.h:17
std::vector< DataStreamType > DataStreamMsg
DataStreamType * DataStreamIter

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: