summaryrefslogtreecommitdiff
path: root/03.c
diff options
context:
space:
mode:
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() {