(**************************************************************************
 * You can add new test cases by adding new elements to the following lists
 * Format is:
 * TEST<X>ARG(<weight>, <function_name>, <arg1>, <arg2>, ..., <argX>)
 *
 * <X> is the number of argument that the function being tested takes.
 **************************************************************************)

open Common

(* This list is for regular problems *)
let rubric =
[
  TEST2ARG(0, consk, (1, []), (List.map string_of_int));
  TEST2ARG(0, consk, (1, []), (fun x -> ()));
  TEST2ARG(0, concatk, ("hello", "world"), (fun s -> (s , String.length s)));
  TEST2ARG(0, concatk, ("hello", "world"), (fun s -> ()));
  TEST2ARG(0, string_of_intk, 1, (fun s -> (s , String.length s)));
  TEST2ARG(0, string_of_intk, 1, (fun s -> ()));
  TEST2ARG(0, truncatek, 3.14, string_of_int);
  TEST2ARG(0, truncatek, 3.14, (fun s -> ()));

  TEST2ARG(1, diff_flipk, 1, report_int);
  TEST2ARG(0, diff_flipk, 1, (fun s -> ()));

  TEST2ARG(1, quadk, (1, 1, 1), report_int);
  TEST2ARG(0, quadk, (1, 1, 1), (fun s -> ()));
  
  TEST2ARG(1, three_freezek, ("muda", "plop"), (fun s -> (s, String.length s)));
  TEST2ARG(0, three_freezek, ("muda", "plop"), (fun s -> ()));

  TEST2ARG(1, shiftk, ("--", 3.14), (fun s -> (s , String.length s)));
  TEST2ARG(0, shiftk, ("--", 3.14), (fun s -> ()));
 
  TEST1ARG(1, list_prod, [1;2;3]);
  TEST2ARG(0, list_prodk, [], (fun s -> ()));
  TEST2ARG(0, list_prodk, [], (fun s -> (grab_trace s;())));
  TEST2ARG(1, list_prodk, [1;2;3], grab_trace);

  TEST1ARG(1, all_positive, [5;3;6;(-1);7]);
  TEST2ARG(0, all_positivek, [], (fun b -> ()));
  TEST2ARG(0, all_positivek, [], (fun b -> (grab_trace b;())));
  TEST2ARG(1, all_positivek, [5;3;6;(-1);7], (fun b -> if b then "true" else "false"));

  TEST1ARG(1, even_count, [1;2;3]);
  TEST2ARG(1, even_countk, [1;2;3], string_of_int);
  TEST2ARG(0, even_countk, [1;2;3], (fun s -> ()));
  TEST2ARG(0, even_countk, [1;2;3], (fun s -> (grab_trace(s);())));

  TEST1ARG(1, find_all, ((fun x -> x mod 2 = 0), [-3; 5; 2; -6])) ;
  TEST2ARG(0, find_allk, ((fun x -> fun k -> k true), [()]), (fun s -> ()));
  TEST2ARG(0, find_allk, ((fun x -> fun k -> k true), [()]), (fun s -> grab_trace(s);()));
  TEST2ARG(1, find_allk, ((fun x -> fun k -> modk (x, 2) (fun n -> eqk (n, 0) k)), [-3; 5; 2; -6]), (fun s -> (grab_trace(List.map string_of_int s))));

  TEST1ARG(1, sum_all, ((fun x -> truncate x >= 2), [1.3;2.5;3.9]));
  TEST2ARG(0, sum_allk, ((fun x -> fun k -> k true), []), (fun s -> ()));
  TEST2ARG(0, sum_allk, ((fun x -> fun k -> k true), []), (fun s -> grab_trace(s);()));
  TEST2ARG(1, sum_allk, ((fun x -> fun k -> Solution.truncatek x (fun y -> geqk(y,2) k)), [1.3;2.5;3.9]), (fun s -> grab_trace(string_of_float s)))
]
(* Note: the last entry should not be followed by a semicolon. *)

let extra_rubric = [
	TEST1ARG(1, list_compose, [(fun x -> x * x) ; (fun x -> x + 2)]);
	TEST2ARG(1, list_composek, [(fun x -> mulk(x,x)) ; (fun x -> addk(x,2))], string_of_int);
	TEST2ARG(0, list_composek, [(fun x -> mulk(x,x)) ; (fun x -> addk(x,2))], (fun s -> ()));
	TEST2ARG(0, list_composek, [], (fun s -> (grab_trace s; ())))
]
