mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -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
|
||||
Build$: flag(bench)
|
||||
MainIs: benchs.ml
|
||||
BuildDepends: containers,containers.string,containers.misc,bench
|
||||
BuildDepends: containers,containers.string,containers.misc,bench,containers.advanced
|
||||
|
||||
Executable bench_conv
|
||||
Path: benchs/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
(** benchmark CCBatch *)
|
||||
|
||||
open Containers_advanced
|
||||
|
||||
module type COLL = sig
|
||||
val name : string
|
||||
include CCBatch.COLLECTION
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ let () =
|
|||
Printf.printf "list of 5 elements...\n";
|
||||
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
|
||||
Printf.printf "list of %d elements...\n" (List.length 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
|
||||
| Empty -> CCHash.string_ "empty" h
|
||||
| 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
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ let test_mvar () =
|
|||
()
|
||||
|
||||
let test_parallel () =
|
||||
let l = CCSequence.(1 -- 300)
|
||||
|> CCSequence.map (fun _ -> Future.spawn (fun () -> Thread.delay 0.1; 1))
|
||||
|> CCSequence.to_list in
|
||||
let l = CCSequence.(1 -- 300) in
|
||||
let l = CCSequence.map (fun _ -> Future.spawn (fun () -> Thread.delay 0.1; 1)) l in
|
||||
let l = CCSequence.to_list l in
|
||||
let l' = List.map Future.get l in
|
||||
OUnit.assert_equal 300 (List.fold_left (+) 0 l');
|
||||
()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue