summaryrefslogtreecommitdiff
path: root/01.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 /01.c
parent4c42453d856053bb49affef7c165397e5c16d9eb (diff)
add expected results to previous days
Diffstat (limited to '01.c')
-rw-r--r--01.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/01.c b/01.c
index 33c52aa..e2e97ba 100644
--- a/01.c
+++ b/01.c
@@ -3,20 +3,22 @@
#include "input.h"
#define INPUT "input/01.txt"
+#define EXPECTED1 1466L
+#define EXPECTED2 1491L
void part1(struct input_int* input) {
// compute depth variations
- int result = 0;
+ long result = 0;
for(size_t i = 1; i < input->line_count; i++) {
if(input->lines[i] > input->lines[i-1])
result++;
}
- printf("%d\n", result);
+ CHECK(result, EXPECTED1)
}
void part2(struct input_int* input) {
// compute depth variations
- int result = 0;
+ long result = 0;
int windowSum = input->lines[0] + input->lines[1] + input->lines[2];
for(size_t i = 1; i < input->line_count - 2; i++) {
int newWindowSum = input->lines[i] + input->lines[i+1] + input->lines[i+2];
@@ -25,7 +27,7 @@ void part2(struct input_int* input) {
windowSum = newWindowSum;
}
- printf("%d\n", result);
+ CHECK(result, EXPECTED2)
}
int main() {