Day 2 Part 2

This commit is contained in:
April Eaton 2025-12-02 18:28:42 +01:00
parent ccee86dc80
commit 4bd66215be
3 changed files with 91 additions and 3 deletions

View file

@ -110,6 +110,43 @@ pub fn ranges_parse_test() {
]
}
pub fn calibrate() {
pub fn calibrate_test() {
assert day_2.file_to_sum_of_bad_ids("test/calibration.txt") == 1_227_775_554
}
pub fn int_to_substrings_test() {
assert day_2.digits_to_substrings([1, 2, 3, 4]) == [[1], [1, 2], [1, 2, 3]]
}
pub fn can_repeat_into_test() {
assert day_2.can_repeat_into([1, 2], [1, 2, 3, 4])
}
pub fn cannot_repeat_into_test() {
assert !{ day_2.can_repeat_into([1, 2], [1, 2, 3]) }
}
pub fn repeats_into_test() {
assert day_2.repeats_into([1, 2], [1, 2, 1, 2])
}
pub fn doesnot_repeat_into_test() {
assert !day_2.repeats_into([1, 2], [1, 2, 3])
}
pub fn has_doubled_string_test() {
assert day_2.has_repeated_string(1212)
}
pub fn has_trippled_string_test() {
assert day_2.has_repeated_string(121_212)
}
pub fn no_repeated_strings_test() {
assert !day_2.has_repeated_string(123)
}
pub fn calibrate_part2_test() {
assert day_2.file_to_sum_of_bad_ids_part2("test/calibration.txt")
== 4_174_379_265
}