summaryrefslogtreecommitdiff
path: root/ocaml/test/year2024/day01/test_part02.ml
blob: 142add6c25a40789434d1764c9138c75a974daf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 ] ) ]