mirror of
https://github.com/rjNemo/ai_advent_code_2024
synced 2026-06-12 05:26:39 +00:00
feat: Add similarity score calculation for Day 1 Part 2
This commit is contained in:
parent
dc74c4a7b1
commit
bbf027d22a
1 changed files with 3 additions and 2 deletions
|
|
@ -16,10 +16,11 @@ defmodule AdventCode2024Test do
|
||||||
input = "1\t2\n3\t4\n5\t6"
|
input = "1\t2\n3\t4\n5\t6"
|
||||||
assert {[1, 3, 5], [2, 4, 6]} = AdventCode2024.parse_input(input)
|
assert {[1, 3, 5], [2, 4, 6]} = AdventCode2024.parse_input(input)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "calculates total distance between two lists using example input" do
|
test "calculates total distance between two lists using example input" do
|
||||||
left_list = [3, 4, 2, 1, 3, 3]
|
left_list = [3, 4, 2, 1, 3, 3]
|
||||||
right_list = [4, 3, 5, 3, 9, 3]
|
right_list = [4, 3, 5, 3, 9, 3]
|
||||||
|
|
||||||
assert AdventCode2024.calculate_total_distance(left_list, right_list) == 11
|
assert AdventCode2024.calculate_total_distance(left_list, right_list) == 11
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -36,7 +37,7 @@ defmodule AdventCode2024Test do
|
||||||
test "calculates similarity score using example input" do
|
test "calculates similarity score using example input" do
|
||||||
left_list = [3, 4, 2, 1, 3, 3]
|
left_list = [3, 4, 2, 1, 3, 3]
|
||||||
right_list = [4, 3, 5, 3, 9, 3]
|
right_list = [4, 3, 5, 3, 9, 3]
|
||||||
|
|
||||||
assert AdventCode2024.calculate_similarity_score(left_list, right_list) == 31
|
assert AdventCode2024.calculate_similarity_score(left_list, right_list) == 31
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue