CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes564downloads
main.ml43 linesDownload Raw Back to ocaml_tests
1 2module Main = struct3    open OUnit24 5    (* Program start *)6    let constructProductMatrix (grid: int list list) : int list list =   failwith "Not implemented"7 8    (* Program end *)9 10    (* Test cases *)11    12let test1 _ = assert_equal [[24;12];[8;6]] (constructProductMatrix [[1;2];[3;4]])13 14let test2 _ = assert_equal [[2];[0];[0]] (constructProductMatrix [[12345];[2];[1]])15 16let test3 _ = assert_equal [[2];[0];[0]] (constructProductMatrix [[12075; 12075; 7245; 2145; 10350; 11805; 11535]; [11940; 12165; 2145; 10725; 11535; 2145; 11535]; [10350; 10350; 11535; 5970; 11940; 10350; 7245]])17 18let test4 _ = assert_equal [[2];[0];[0]] (constructProductMatrix [[60; 120; 9975; 2550; 240]; [9375; 8535; 1680; 11460; 10650]; [4305; 9975; 240; 8265; 825]; [5448; 3360; 1335; 4440; 8790]])19 20let test5 _ = assert_equal [[2];[0];[0]] (constructProductMatrix [[6705]; [4794]; [3855]; [12270]; [3240]; [11550]; [6750]; [4755]; [11250]])21 22let test6 _ = assert_equal [[2];[0];[0]] (constructProductMatrix [[9285]; [2235]; [4700]; [3375]; [9615]; [3600]])23 24let test7 _ = assert_equal [[2];[0];[0]] (constructProductMatrix [[9780; 9345; 11940; 5865; 6480]; [7320; 11640; 9240; 1080; 4410]; [30; 3435; 12075; 10755; 150]; [1215; 8415; 7410; 8925; 12225]; [8340; 4500; 4785; 768; 855]])25 26 27    (* Grouping test cases *)28    let suite = "Test Suite for constructProductMatrix" >::: [29        30  "test1" >:: test1;31  "test2" >:: test2;32  "test3" >:: test3;33  "test4" >:: test4;34  "test5" >:: test5;35  "test6" >:: test6;36  "test7" >:: test7;37    ]38 39 40    (* Running the tests *)41    let () = run_test_tt_main suite42end43