-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_last_move.c
54 lines (44 loc) · 1.33 KB
/
test_last_move.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <head-unit.h>
#include "last_move.h"
static void test_last_move_miss_a_go(void)
{
char last_move[100] = "";
char name[10] = "James";
set_last_move_was_miss_a_go(last_move, name);
assert_string_equals("James layed miss a go card\n", last_move);
}
static void test_last_move_was_burn(void)
{
char last_move[100] = "";
char name[10] = "James";
set_last_move_was_burn(last_move, name);
assert_string_equals("James burnt the deck\n", last_move);
}
static void test_last_move_pickup(void)
{
char last_move[100] = "";
char name[10] = "James";
set_last_move_pickup(last_move, name);
assert_string_equals("James picked up\n", last_move);
}
static void test_last_move_with_cards(void)
{
char last_move[100] = "";
char name[10] = "James";
int ncards = 3;
struct card_t cards[3];
cards[0] = make_card(ACE, SPADES);
cards[1] = make_card(THREE, DIAMONDS);
cards[2] = make_card(SEVEN, HEARTS);
set_last_move(last_move, name, cards, ncards);
assert_string_equals("James laid: ACE of SPADES, THREE of DIAMONDS, SEVEN of HEARTS, \n",
last_move);
}
void register_last_move_tests(void)
{
TEST_MODULE("test_last_move");
TEST(test_last_move_miss_a_go);
TEST(test_last_move_was_burn);
TEST(test_last_move_pickup);
TEST(test_last_move_with_cards);
}