File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed
Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ open Base
2+
3+ let print_int_list = Fn. compose Sexp. to_string (sexp_of_list sexp_of_int)
Original file line number Diff line number Diff line change 1+ open Base
2+
3+ let cubes = List. map ~f: Int. (fun x -> x ** 3 )
Original file line number Diff line number Diff line change 1+ open Base
2+ open OUnit
3+ open Preloaded
4+
5+ let suite = [
6+ (* "sum tests" >:::
7+ [
8+ "Testing 1" >:: (fun _ -> assert_equal 1 (Solution.sum 1) ~printer:print_int);
9+ "Testing 9" >:: (fun _ -> assert_equal 45 (Solution.sum 9) ~printer:print_int);
10+ ]; *)
11+ " cubes tests (passing)" > :::
12+ [
13+ " Testing [1; 2; 3]" > :: (fun _ -> assert_equal [1 ; 8 ; 27 ] (Solution. cubes (List. range 1 4 )) ~printer: print_int_list);
14+ " Testing [5]" > :: (fun _ -> assert_equal [125 ] (Solution. cubes [5 ]) ~printer: print_int_list);
15+ ];
16+ " cubes tests (failing)" > :::
17+ [
18+ " Testing [1; 2; 3]" > :: (fun _ -> assert_equal [1 ; 8 ; 27 ] (Solution. cubes (List. range 1 5 )) ~printer: print_int_list);
19+ ];
20+ ]
You can’t perform that action at this time.
0 commit comments