-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cc
More file actions
75 lines (59 loc) · 1.29 KB
/
Copy pathtest.cc
File metadata and controls
75 lines (59 loc) · 1.29 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifdef TEST
#include <iostream>
#include "tetravex.hh"
#include "utils.hh"
#include <criterion/criterion.h>
Test(tetravex, load)
{
Tetravex game("data/input/s2-02.txt");
cr_assert_eq(game.size, 2);
cr_assert(game.tiles[0].is_locked);
cr_assert_eq(game.tiles[0].value[NORTH], 0);
cr_assert_eq(game.tiles[1].value[WEST], 2);
cr_assert_eq(game.tiles[2].value[EAST], 2);
cr_assert_eq(game.tiles[3].value[SOUTH], 5);
}
Test(tetravex, error_count_s2_02)
{
Tetravex game("data/input/s2-02.txt");
cr_assert_eq(get_error_count(game), 2);
}
Test(tetravex, error_count_s5_04)
{
Tetravex game("data/input/s5-04.txt");
cr_assert_eq(get_error_count(game), 29);
}
void test_full(int n)
{
auto file_list = get_file_list(n);
int passed = file_list.size();
for (int i = 0; i < file_list.size(); i++)
{
Tetravex game(file_list[i]);
solve(game);
auto err = get_error_count(game);
cr_expect_eq(err, 0, "Error for File: %s", file_list[i].c_str(), passed--);
}
cr_assert_eq(passed, file_list.size(), "Passed %d over %d", passed, file_list.size());
}
Test(tetravex, s2_full)
{
test_full(2);
}
Test(tetravex, s3_full)
{
test_full(3);
}
Test(tetravex, s4_full)
{
test_full(4);
}
Test(tetravex, s5_full)
{
test_full(5);
}
Test(tetravex, s6_full)
{
test_full(6);
}
#endif