mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
fixed benchs/tests for 4.00
This commit is contained in:
parent
df838482ef
commit
f67a3e115e
5 changed files with 8 additions and 5 deletions
2
_oasis
2
_oasis
|
|
@ -149,7 +149,7 @@ Executable benchs
|
||||||
CompiledObject: native
|
CompiledObject: native
|
||||||
Build$: flag(bench)
|
Build$: flag(bench)
|
||||||
MainIs: benchs.ml
|
MainIs: benchs.ml
|
||||||
BuildDepends: containers,containers.string,containers.misc,bench
|
BuildDepends: containers,containers.string,containers.misc,bench,containers.advanced
|
||||||
|
|
||||||
Executable bench_conv
|
Executable bench_conv
|
||||||
Path: benchs/
|
Path: benchs/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
(** benchmark CCBatch *)
|
(** benchmark CCBatch *)
|
||||||
|
|
||||||
|
open Containers_advanced
|
||||||
|
|
||||||
module type COLL = sig
|
module type COLL = sig
|
||||||
val name : string
|
val name : string
|
||||||
include CCBatch.COLLECTION
|
include CCBatch.COLLECTION
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ let () =
|
||||||
Printf.printf "list of 5 elements...\n";
|
Printf.printf "list of 5 elements...\n";
|
||||||
bench_list [1,2; 3,4; 5,6; 7,8; 9,10];
|
bench_list [1,2; 3,4; 5,6; 7,8; 9,10];
|
||||||
|
|
||||||
|
let open CCFun in
|
||||||
let l = CCGen.(1 -- 100 |> map (fun x->x,x) |> to_rev_list) in
|
let l = CCGen.(1 -- 100 |> map (fun x->x,x) |> to_rev_list) in
|
||||||
Printf.printf "list of %d elements...\n" (List.length l);
|
Printf.printf "list of %d elements...\n" (List.length l);
|
||||||
bench_list l;
|
bench_list l;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ let rec eq t1 t2 = match t1, t2 with
|
||||||
let rec hash_tree t h = match t with
|
let rec hash_tree t h = match t with
|
||||||
| Empty -> CCHash.string_ "empty" h
|
| Empty -> CCHash.string_ "empty" h
|
||||||
| Node (i, l) ->
|
| Node (i, l) ->
|
||||||
h |> CCHash.string_ "node" |> CCHash.int_ i |> CCHash.list_ hash_tree l
|
CCHash.list_ hash_tree l (CCHash.int_ i (CCHash.string_ "node" h))
|
||||||
|
|
||||||
module Box = Containers_misc.PrintBox
|
module Box = Containers_misc.PrintBox
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@ let test_mvar () =
|
||||||
()
|
()
|
||||||
|
|
||||||
let test_parallel () =
|
let test_parallel () =
|
||||||
let l = CCSequence.(1 -- 300)
|
let l = CCSequence.(1 -- 300) in
|
||||||
|> CCSequence.map (fun _ -> Future.spawn (fun () -> Thread.delay 0.1; 1))
|
let l = CCSequence.map (fun _ -> Future.spawn (fun () -> Thread.delay 0.1; 1)) l in
|
||||||
|> CCSequence.to_list in
|
let l = CCSequence.to_list l in
|
||||||
let l' = List.map Future.get l in
|
let l' = List.map Future.get l in
|
||||||
OUnit.assert_equal 300 (List.fold_left (+) 0 l');
|
OUnit.assert_equal 300 (List.fold_left (+) 0 l');
|
||||||
()
|
()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue