let make_regression_testsuite (module L : Adapton.Signatures.SAListType) =

let module I = L.Make (Adapton.Types.Int) in

- let test_salist_op ?(count=25) ?incl op sa_op =

+ let test_salist_op_with_test ?(count=25) ?incl op sa_op ~test =

Gc.compact (); (* try to make GC effects consistent across tests *)

QC.forall ~count ?incl (QC.pair (QC.list QC.int) (QC.list (QC.list (QC.triple QC.bool QC.int QC.int)))) begin fun ( xs, kss ) ->

let n = List.length xs in

let xs' = I.of_list xs in

- let zs' = I.to_list ys' in

- ~~assert_list_equal~~ ~msg:"initial" ~~z~~s ~~z~~s';

+ test ~msg:"initial" ys ys';

ignore begin List.fold_left begin fun ( xs, xs', n ) ks ->

let xs, n' = List.fold_left begin fun ( xs, n ) ( i, k, x ) ->

( delete k [] xs, pred n )

ignore begin List.fold_left begin fun n ( i, k, x ) ->

- let zs' = I.to_list ys' in

- ~~assert_list_equal~~ ~msg:"update" ~~z~~s ~~z~~s';

+ test ~msg:"update" ys ys';

end ( xs, xs', n ) kss end

+ let test_salist_op = test_salist_op_with_test ~test:(fun ~msg expected actual -> assert_list_equal ~msg expected (I.to_list actual)) in

"filter" >:: QC.forall QC.int begin fun p ->

test_salist_op (List.map fn) map_fn

+ "tfold" >:: begin fun () ->

+ let tfold_fn, _ = I.memo_tfold fn in

+ test_salist_op_with_test

+ ~test:(fun ~msg expected actual -> assert_int_equal ~msg expected (I.SAData.force actual))

+ (List.fold_left fn 0) (fun xs' -> tfold_fn (I.const (`Cons ( 0, xs' )))) (* prepend 0 to avoid empty lists *)

"quicksort" >:: begin fun () ->

let quicksort, _ = I.memo_quicksort compare in