summaryrefslogtreecommitdiff
path: root/ocaml/test/year2024/day01/test_part02.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml/test/year2024/day01/test_part02.ml')
-rw-r--r--ocaml/test/year2024/day01/test_part02.ml16
1 files changed, 16 insertions, 0 deletions
diff --git a/ocaml/test/year2024/day01/test_part02.ml b/ocaml/test/year2024/day01/test_part02.ml
new file mode 100644
index 0000000..142add6
--- /dev/null
+++ b/ocaml/test/year2024/day01/test_part02.ml
@@ -0,0 +1,16 @@
+open Year2024.Day01.Part02
+
+let test_solve haveLeft haveRight want () =
+ Alcotest.(check int) "incorrect solution" want @@ solve haveLeft haveRight
+
+let () =
+ let open Alcotest in
+ run "test suite for day 01 part 02"
+ [ ( "test solutions"
+ , [ test_case "empty list is 0" `Quick @@ (test_solve [] []) 0
+ ; test_case "ten x zero occurrances of ten" `Quick
+ @@ (test_solve [10] [1; 2; 3]) 0
+ ; test_case "two x three occurrances of two" `Quick
+ @@ (test_solve [2] [2; 2; 2]) 6
+ ; test_case "solves example correctly" `Quick
+ @@ (test_solve [3; 4; 2; 1; 3; 3] [4; 3; 5; 3; 9; 3]) 31 ] ) ]