summaryrefslogtreecommitdiff
path: root/03.c
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2021-12-05 22:53:32 +0100
committerVincent Douillet <vincent@vdouillet.fr>2021-12-05 22:53:32 +0100
commit8a8417207729cb92ae4f3038a3a8bd5e6a0c0ce7 (patch)
treea1366131e356ffadfa081c1561c968a2570a9843 /03.c
parent4c42453d856053bb49affef7c165397e5c16d9eb (diff)
add expected results to previous days
Diffstat (limited to '03.c')
-rw-r--r--03.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/03.c b/03.c
index 738062c..36cc0d4 100644
--- a/03.c
+++ b/03.c
@@ -5,6 +5,9 @@
#include "input.h"
#define INPUT "input/03.txt"
+#define EXPECTED1 2972336L
+#define EXPECTED2 0L
+
#define INPUT_SIZE 12
unsigned long parse_line(char* binary_line, char expected_end) {
@@ -48,7 +51,7 @@ unsigned long compute_epsilon(unsigned long gamma) {
void part1(struct input_str* input) {
unsigned long gamma = compute_gamma(input);
unsigned long epsilon = compute_epsilon(gamma);
- printf("%ld\n", gamma * epsilon);
+ CHECK(gamma * epsilon, EXPECTED1)
}
unsigned long search_criteria(struct input_str* input, unsigned long criteria) {
@@ -91,7 +94,7 @@ void part2(struct input_str* input) {
unsigned long o2_rate = search_criteria(input, o2_criteria);
unsigned long co2_criteria = compute_epsilon(o2_criteria);
unsigned long co2_scrub = search_criteria(input, co2_criteria);
- printf("%ld\n", o2_rate * co2_scrub);
+ CHECK(o2_rate * co2_scrub, EXPECTED2)
}
int main() {