From f2d027ac19cf5839ab40d0173f1b086344a4b955 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Thu, 7 Aug 2014 13:25:38 +0200 Subject: [PATCH] fix tests for containers.thread --- _oasis | 6 +++--- tests/threads/test_future.ml | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/_oasis b/_oasis index db498281..67e1812b 100644 --- a/_oasis +++ b/_oasis @@ -176,12 +176,12 @@ Executable test_lwt BuildDepends: containers,lwt,lwt.unix,oUnit,containers.lwt Executable test_threads - Path: tests/lwt/ + Path: tests/threads/ Install: false CompiledObject: best Build$: flag(tests) && flag(thread) - MainIs: test_Future.ml - BuildDepends: containers,threads,oUnit,containers.lwt + MainIs: test_future.ml + BuildDepends: containers,threads,oUnit,containers.thread Test all Command: make test-all diff --git a/tests/threads/test_future.ml b/tests/threads/test_future.ml index ce7420b4..becf7f52 100644 --- a/tests/threads/test_future.ml +++ b/tests/threads/test_future.ml @@ -3,6 +3,8 @@ open OUnit +module Future = CCFuture + let test_mvar () = let box = Future.MVar.empty () in let f = Future.spawn (fun () -> Future.MVar.take box + 1) in @@ -13,10 +15,9 @@ let test_mvar () = () let test_parallel () = - let open Gen.Infix in - let l = 1 -- 300 - |> Gen.map (fun _ -> Future.spawn (fun () -> Thread.delay 0.1; 1)) - |> Gen.to_list in + let l = CCSequence.(1 -- 300) + |> CCSequence.map (fun _ -> Future.spawn (fun () -> Thread.delay 0.1; 1)) + |> CCSequence.to_list in let l' = List.map Future.get l in OUnit.assert_equal 300 (List.fold_left (+) 0 l'); ()