let rubric_version = "1.0"
let rubric_title = "CS421 Fall 2019 MP1"

(**************************************************************************
 * 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.
 **************************************************************************)

let file = "student.ml"

let map_product_stu = ((List.map Student.product): float list list -> float list)
let map_product_sol = List.map Solution.product

let map_sub_list_stu1 l1 l2= List.map (Student.sub_list l1) l2
let map_sub_list_sol1 l1 l2= List.map (Solution.sub_list l1) l2
let map_sub_list_stu2 l1 l2= List.map (fun x-> Student.sub_list x l2) l1
let map_sub_list_sol2 l1 l2= List.map (fun x->Solution.sub_list x l2) l1

let even_count_fr_stu l = List.fold_right Student.even_count_fr_rec l Student.even_count_fr_base
let even_count_fr_sol l = List.fold_right Solution.even_count_fr_rec l Solution.even_count_fr_base

let pair_sums_map_arg_stu l = List.map Student.pair_sums_map_arg l
let pair_sums_map_arg_sol l = List.map Solution.pair_sums_map_arg l

let remove_even_stu l = List.fold_right Student.remove_even_rec l Student.remove_even_base
let remove_even_sol l = List.fold_right Solution.remove_even_rec l Solution.remove_even_base

(*
let sift_stu f lst = List.fold_right (Student.sift_rec f) lst Student.sift_base
let sift_sol f lst = List.fold_right (Solution.sift_rec f) lst Solution.sift_base
*)

let even_count_tr_stu l = List.fold_left Student.even_count_tr_step Student.even_count_tr_start l
let even_count_tr_sol l = List.fold_left Solution.even_count_tr_step Solution.even_count_tr_start l
(*
let count_element_stu l m = List.fold_left (Student.count_element_step m) Student.count_element_start l
let count_element_sol l m = List.fold_left (Solution.count_element_step m) Solution.count_element_start l
*)
let split_sum_stu l f = List.fold_left (Student.split_sum_step f) Student.split_sum_start l
let split_sum_sol l f = List.fold_left (Solution.split_sum_step f) Solution.split_sum_start l

(*
let all_nonneg_stu l = List.fold_left Student.all_nonneg_step Student.all_nonneg_start l
let all_nonneg_sol l = List.fold_left Solution.all_nonneg_step Solution.all_nonneg_start l

let exists_between_stu m n l = List.fold_left (Student.exists_between_step m n) Student.exists_between_start l
let exists_between_sol m n l = List.fold_left (Solution.exists_between_step m n) Solution.exists_between_start l

let rev_append_stu l = List.fold_right Student.rev_append_rec l Student.rev_append_base
let rev_append_sol l = List.fold_right Solution.rev_append_rec l Solution.rev_append_base
*)

open Check_recursion
let app_all_with_form_check  = fun _ -> true
let forward_recursion_check = fun _ -> fun _ -> true
let tail_recursion_check = fun _ -> fun _ -> true
(*
let check_forward file progname =
    let (is_fwd, is_tl, lib_deps) = List.assoc progname (classify_decs (decs_from_file file) [])
    in is_fwd && (List.for_all (fun d -> d = "List.map") lib_deps)

let check_tail file progname =
    let (is_fwd, is_tl, lib_deps) = List.assoc progname (classify_decs (decs_from_file file) [])
    in is_tl && (List.for_all (fun d -> d = "List.map") lib_deps)
*)

(* This list is for regular problems *)
let rubric =
[
(* Problem 1, 2 pts *)
    TEST1ARG(1, product, [2.; 3.; 4.]);

(* Problem 2, 2 pts *)
    TEST1ARG(1, double_all, []);

(* Problem 3, 3 pts *)
    TEST2ARG(1, pair_with_all, 1, ["a"; "b"; "c"]);
    TEST2ARG(0, pair_with_all, (), [()]);

(* Problem 4, 4 pts *)
    TEST2ARG(1, interleave, [1;3;5], [2;4]);

(* Problem 5, 5 pts *)
    TEST2ARG(1, sub_list, [1;1;2;1;1;4;1], [1;2;1;1;1]);
    TEST2ARG(0, sub_list, [()], [()]);

(* Problem 6, 3 pts  *)
    TEST1ARG(1, even_count_fr, [1;2;3]);
    TEST2ARG_TWOFUN(1, forward_recursion_check,
                    check_forward_recursive_no_libs, file, "even_count_fr");

(* Problem 7, 3 pts  *)
    TEST1ARG(1, pair_sums, [(1,6);(3,1);(3,2)]);
    TEST2ARG_TWOFUN(1, forward_recursion_check,
                    check_forward_recursive_no_libs, file, "pair_sums");
    
(* Problem 8, 3 pts  *)
    TEST1ARG(1, remove_even,  [1; 4; 3; 7; 2; 8]) ;
    TEST2ARG_TWOFUN(1, forward_recursion_check, check_forward_recursive_no_libs, file, "remove_even");

(* Problem 9, 3 pts  *)
    TEST2ARG(1, sift, (fun x -> x mod 2 = 0), [-3; 5; 2; -6]) ;
    TEST2ARG(1, sift, (fun x -> true), [()]) ;
    TEST2ARG_TWOFUN(3, forward_recursion_check, check_forward_recursive_no_libs, file, "sift");
    
(* Problem 10, 5 pts *)
    TEST3ARG(1, apply_even_odd, [1;2;3], (fun x -> x + 1), (fun x -> x - 1));
    TEST3ARG(0, apply_even_odd, [((),())], (fun (x, y) -> ()), (fun (x, y) -> ()));
    TEST2ARG_TWOFUN(1, forward_recursion_check, check_forward_recursive_no_libs, file, "apply_even_odd");

(* Problem 11, 3 pts *)
    TEST1ARG(1, even_count_tr, [1;2;3]);
    TEST2ARG_TWOFUN(1, tail_recursion_check, check_tail_recursive_no_libs, file, "even_count_tr");

(* Problem 12, 3 pts  *)
    TEST2ARG(1, count_element, [0;1;2;4;2;5;4;2], 2);
    TEST2ARG(0, count_element, [()], ());
    TEST2ARG_TWOFUN(1, tail_recursion_check, check_tail_recursive_no_libs, file, "count_element");

(* Problem 13, 3 pts  *)
    TEST1ARG(1, all_nonneg, [4; 7; -3; 5]);
    TEST2ARG_TWOFUN(1, tail_recursion_check, check_tail_recursive_no_libs, file, "all_nonneg");

(* Problem 14, 3 pts  *)
    TEST2ARG(1, split_sum, [1;2;3], (fun x -> x>1));
    TEST2ARG_TWOFUN(1, tail_recursion_check, check_tail_recursive_no_libs, file, "split_sum");

(* Problem 15, 5 pts *)
    TEST2ARG(1, concat, " * ", ["3"; "6"; "2"]);
    TEST2ARG_TWOFUN(1, tail_recursion_check, check_tail_recursive_no_libs, file, "concat");

(* Problem 16, 3 pts  *)
    TEST1ARG_TWOFUN(1, even_count_fr_sol, even_count_fr_stu, [1; 2; 3]);

(* Problem 17, 3 pts  *)
    TEST1ARG_TWOFUN(1, pair_sums_map_arg_sol, pair_sums_map_arg_stu, [(1,6);(3,1);(3,2)]);

(* Problem 18, 3 pts *)
    TEST1ARG_TWOFUN(1, remove_even_sol, remove_even_stu,  [1; 4; 3; 7; 2; 8]) ;

    (* Problem 19 3 pts  *)
    TEST1ARG_TWOFUN(1, even_count_tr_sol, even_count_tr_stu, [1; 2; 3]);
    (* Problem 20 *)
	TEST2ARG_TWOFUN(1, split_sum_sol, split_sum_stu, [1;2;3], (fun x -> x>1))
]

(* Note: the last entry should not be followed by a semicolon. *)

let extra_rubric = 
[ ]
