-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_passwords.c
87 lines (77 loc) · 2.09 KB
/
test_passwords.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <stdio.h>
#include <assert.h>
#include <stdint.h>
#include "password.h"
void beatAllMaxEtanks(void) {
struct options config;
config.etanks = 4;
// beaten = 0, alive = 1
config.bubbleman = 0;
config.airman = 0;
config.quickman = 0;
config.woodman = 0;
config.crashman = 0;
config.flashman = 0;
config.metalman = 0;
config.heatman = 0;
config.debug = 1;
const uint32_t ACTUAL = generatePassword(&config);
const uint32_t EXPECTED = 0x10162AA;
assert(EXPECTED == ACTUAL);
}
void beatAllZeroEtanks(void) {
struct options config;
config.etanks = 0;
config.bubbleman = 0;
config.airman = 0;
config.quickman = 0;
config.woodman = 0;
config.crashman = 0;
config.flashman = 0;
config.metalman = 0;
config.heatman = 0;
config.debug = 1;
const uint32_t ACTUAL = generatePassword(&config);
const uint32_t EXPECTED = 0x1A162A;
assert(EXPECTED == ACTUAL);
}
void fourBeatenAndTwoTanks(void) {
struct options config;
config.etanks = 2;
config.bubbleman = 1;
config.airman = 1;
config.quickman = 0;
config.woodman = 0;
config.crashman = 0;
config.flashman = 0;
config.metalman = 1;
config.heatman = 1;
config.debug = 1;
const uint32_t ACTUAL = generatePassword(&config);
const uint32_t EXPECTED = 0x436AA0;
assert(EXPECTED == ACTUAL);
}
void twoBeatenAndTwoTanks(void) {
struct options config;
config.etanks = 2;
config.bubbleman = 0;
config.airman = 0;
config.quickman = 1;
config.woodman = 1;
config.crashman = 1;
config.flashman = 1;
config.metalman = 1;
config.heatman = 1;
config.debug = 1;
const uint32_t ACTUAL = generatePassword(&config);
const uint32_t EXPECTED = 0x4F1441;
assert(EXPECTED == ACTUAL);
}
int main() {
twoBeatenAndTwoTanks();
beatAllZeroEtanks();
beatAllMaxEtanks();
fourBeatenAndTwoTanks();
printf("All unit tests successfully passed!\n");
return 0;
}