From 8a8417207729cb92ae4f3038a3a8bd5e6a0c0ce7 Mon Sep 17 00:00:00 2001 From: Vincent Douillet Date: Sun, 5 Dec 2021 22:53:32 +0100 Subject: add expected results to previous days --- 03.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to '03.c') 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() { -- cgit v1.2.3