From bc8b9edc0860f4804dfd0ea868ee7beaa564e62a Mon Sep 17 00:00:00 2001 From: DJ O'Leary Date: Sat, 27 Jun 2026 04:28:48 +0200 Subject: test: fix ocaml tests 2024 {WIP} --- ocaml/test/year2024/day01/test_part02.ml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 ocaml/test/year2024/day01/test_part02.ml (limited to 'ocaml/test/year2024/day01/test_part02.ml') 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 ] ) ] -- cgit v1.2.3