Snoke
Snake_init.h
Go to the documentation of this file.
1 #ifndef SNAKE_INIT_H
2 #define SNAKE_INIT_H
3 
4 #include "shared.h"
5 #include "Snake/snake.h"
6 
10 TEST(Snake_init, test0){
11  Snake snake;
12  SUCCEED();
13 }
14 
18 TEST(Snake_init, test1) {
19 
20  /*
21  * Minimal environment block for the Snake_init
22  */
23  Snake snake;
24  Point begin;
25  begin.x = 1;
26  begin.y = 1;
27  short direction = MVRIGHT;
28  int length = 5;
29 
30  bool retVal = snake.init(begin, direction, length);
31 
32  if(retVal)
33  {
34  SUCCEED();
35  }
36  else
37  {
38  FAIL();
39  }
40 }
41 
45 TEST(Snake_init, test2) {
46 
47  /*
48  * Minimal environment block for the Snake_init
49  */
50  Snake snake;
51  Point begin;
52  begin.x = 1;
53  begin.y = 1;
54  short direction = MVUP;
55  int length = 5;
56 
57  bool retVal = snake.init(begin, direction, length);
58 
59  if(!retVal)
60  {
61  SUCCEED();
62  }
63  else
64  {
65  FAIL();
66  }
67 }
68 
72 TEST(Snake_init, test3) {
73 
74  /*
75  * Minimal environment block for the Snake_init
76  */
77  Snake snake;
78  Point begin;
79  begin.x = 1;
80  begin.y = 1;
81  short direction = MVLEFT;
82  int length = 5;
83 
84  bool retVal = snake.init(begin, direction, length);
85 
86  if(!retVal)
87  {
88  SUCCEED();
89  }
90  else
91  {
92  FAIL();
93  }
94 }
95 
99 TEST(Snake_init, test4) {
100 
101  /*
102  * Minimal environment block for the Snake_init
103  */
104  Snake snake;
105  Point begin;
106  begin.x = -1;
107  begin.y = 1;
108  short direction = MVLEFT;
109  int length = 5;
110 
111  bool retVal = snake.init(begin, direction, length);
112 
113  if(!retVal)
114  {
115  SUCCEED();
116  }
117  else
118  {
119  FAIL();
120  }
121 }
122 
126 TEST(Snake_init, test5) {
127 
128  /*
129  * Minimal environment block for the Snake_init
130  */
131  Snake snake;
132  Point begin;
133  begin.x = 1;
134  begin.y = -1;
135  short direction = MVLEFT;
136  int length = 5;
137 
138  bool retVal = snake.init(begin, direction, length);
139 
140  if(!retVal)
141  {
142  SUCCEED();
143  }
144  else
145  {
146  FAIL();
147  }
148 }
149 
153 TEST(Snake_init, test6) {
154 
155  /*
156  * Minimal environment block for the Snake_init
157  */
158  Snake snake;
159  Point begin;
160  begin.x = -1;
161  begin.y = -1;
162  short direction = MVLEFT;
163  int length = 5;
164 
165  bool retVal = snake.init(begin, direction, length);
166 
167  if(!retVal)
168  {
169  SUCCEED();
170  }
171  else
172  {
173  FAIL();
174  }
175 }
176 
177 
178 #endif // SNAKE_INIT_H
short x
Definition: common.h:55
TEST(Snake_init, test0)
Snake class object can be created.
Definition: Snake_init.h:10
bool init(Point begin, short direction, int length)
Initializes snake as an entity without ancoring it anywhere.
Definition: snake.cpp:20
const int MVLEFT
snake's head is moving left
Definition: snake.h:60
shared functions for testing
short y
Definition: common.h:56
const int MVUP
snake's head is moving up
Definition: snake.h:64
Describes the Snake entity of the game.
Definition: snake.h:79
const int MVRIGHT
snake's head is moving right
Definition: snake.h:52
Coordinates and style of the cell in console window.
Definition: common.h:52
Definitions and prototypes for Snake class.