Add non-regression test for previous commit.

master
Alain Frisch 2016-03-10 15:10:02 +01:00
parent dcc98090cb
commit b1e2c5acd6
2 changed files with 23 additions and 0 deletions

View File

@ -250,3 +250,14 @@ let _ =
TWSL.test (list_data d); TWSL.test (list_data d);
printf "-- Weak Kn -- Arrays of strings\n%!"; printf "-- Weak Kn -- Arrays of strings\n%!";
TWSA.test (Array.map (fun (l,i) -> (Array.of_list l,i)) (list_data d)) TWSA.test (Array.map (fun (l,i) -> (Array.of_list l,i)) (list_data d))
let () =
let h = Hashtbl.create 16 in
for i = 1 to 1000 do Hashtbl.add h i (i * 2) done;
Printf.printf "%i elements\n" (Hashtbl.length h);
Hashtbl.filter_map_inplace (fun k v -> if k mod 100 = 0 then ((*Hashtbl.add h v v;*) Some (v / 100)) else None) h;
let l = Hashtbl.fold (fun k v acc -> (k, v) :: acc) h [] in
let l = List.sort compare l in
List.iter (fun (k, v) -> Printf.printf "%i,%i\n" k v) l;
Printf.printf "%i elements\n" (Hashtbl.length h)

View File

@ -42,3 +42,15 @@ Removal: passed
Insertion: passed Insertion: passed
Insertion: passed Insertion: passed
Removal: passed Removal: passed
1000 elements
100,2
200,4
300,6
400,8
500,10
600,12
700,14
800,16
900,18
1000,20
10 elements