CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes302downloads
main.ml43 linesDownload Raw Back to ocaml_tests
1 2module Main = struct3    open OUnit24 5    (* Program start *)6    let constructTransformedArray (nums: int list) : int list =   failwith "Not implemented"7 8    (* Program end *)9 10    (* Test cases *)11    12let test1 _ = assert_equal [1;1;1;3] (constructTransformedArray [3;-2;1;1])13 14let test2 _ = assert_equal [-1;-1;4] (constructTransformedArray [-1;4;-1])15 16let test3 _ = assert_equal [-1;-1;4] (constructTransformedArray [20; -26; 14; -18; -48; 74; 0; -26; -55; -82; 19; -55; 1; -93; -62; -31; -49; -20; 25; 84; -33; -75; 59; 64; -7; 5; -20; -89; 3; 27; 4; -57; 25; -38; -94; -15; -92; 75; -43; 60; -74; -33; -35; -22; -5; -10; 24; 80; -73; 67; -92; 58; 9; -31; 30; -56; -78])17 18let test4 _ = assert_equal [-1;-1;4] (constructTransformedArray [-23; 42; 69; -97; -58; 97; -47; 65; 45; -93; 31; -44; -78; -49; 81; 60; 51; -80; -74; 87; 20; 1; 86; -32; -80; 58; -23; 6; -92; 9; -99; -11; 44; 71; 56; 50; 6; -64; -61])19 20let test5 _ = assert_equal [-1;-1;4] (constructTransformedArray [61; -63; -16; 10; -39; -16; -95; -44; -16; 21; 4; 18; -56; 53; 39; 69; 29; -87; 43; -75; -81; -3; -66; -18; -73; 38; 9; 75; -98; 43; 67; -49; 100; -9; 62; 32; -13; -2; -81; 79; 88; -1; 16; 27; 81; -90; -88; 15; 60; 33; -20; -12; 86; 20; 83; 10; -55; 88; 82; 32; 98; 7; -66; 60; 54; 50; -42; -99; 69; -29; -98; -51; -54; 65; -63; -16; 11; -82])21 22let test6 _ = assert_equal [-1;-1;4] (constructTransformedArray [55; -64; -7; -6; -30; -37; 16; 58; 57; 33; 62; 82; -6; 94; 65; 0; -74; -32; 50; 70; -85; 55; 43; -70; 38; 75; 98; 86; -79; 41; -80; 65; 68; -17; -15; -92; 84; 5; -93; -8; -10; 32; 46; 40])23 24let test7 _ = assert_equal [-1;-1;4] (constructTransformedArray [1; -93; 55; -75; 27; 83; 4; 93; -63; 60; 89; 46; 7; 5; -67; -62; -49; -18; 77; 2; 44; 48; 76; -58; 99; 92; -2; -99; -35; -32; -61; -26; 49; 95; -69])25 26 27    (* Grouping test cases *)28    let suite = "Test Suite for constructTransformedArray" >::: [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