-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from samoht/master
Remove dependency to OUnit and nocrypto for compiling the tests
- Loading branch information
Showing
6 changed files
with
33 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
(* | ||
* Copyright (c) 2013 Thomas Gazagnaire <[email protected]> | ||
* Copyright (c) 2013-2015 Thomas Gazagnaire <[email protected]> | ||
* | ||
* Permission to use, copy, modify, and distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
|
@@ -19,15 +19,21 @@ open Test_common | |
open Irmin_unix | ||
open Printf | ||
|
||
let random_string n = | ||
let t = Unix.gettimeofday () in | ||
let cs = Cstruct.create 8 in | ||
Cstruct.BE.set_uint64 cs 0 Int64.(of_float (t *. 1000.)) ; | ||
Nocrypto.Rng.reseed cs; | ||
Cstruct.to_string (Nocrypto.Rng.generate n) | ||
let () = Random.self_init () | ||
let random_char () = char_of_int (Random.int 256) | ||
|
||
let long_random_string = | ||
random_string 1024_000 | ||
(* for OCaml > 4.01 *) | ||
module String = struct | ||
include String | ||
let init n f = | ||
let buf = Bytes.create n in | ||
for i =0 to n-1 do Bytes.set buf i (f i) done; | ||
buf | ||
end | ||
|
||
let random_string n = String.init n (fun _i -> random_char ()) | ||
let long_random_string = random_string 1024_000 | ||
let fail fmt = Printf.ksprintf Alcotest.fail fmt | ||
|
||
module Make (S: Irmin.S) = struct | ||
|
||
|
@@ -604,12 +610,8 @@ module Make (S: Irmin.S) = struct | |
let y = [ "left", 1; "bar" , 3; "skip", 0 ] in | ||
let m = [ "left", 2; "bar" , 3] in | ||
merge_x ~old x y >>= function | ||
| `Ok m' -> | ||
assert_equal (module X) "compound merge" m m'; | ||
return_unit | ||
| `Conflict c -> | ||
OUnit.assert_bool (sprintf "compound merge: %s" c) false; | ||
return_unit | ||
| `Ok m' -> assert_equal (module X) "compound merge" m m'; return_unit | ||
| `Conflict c -> fail "conflict %s" c | ||
in | ||
|
||
let test () = | ||
|
@@ -696,9 +698,6 @@ module Make (S: Irmin.S) = struct | |
S.create x.config task >>= fun t -> | ||
let h = h t in | ||
Graph.create (g t 0) [] >>= fun node -> | ||
let fail fmt = | ||
Printf.ksprintf (fun str -> OUnit.assert_string str; assert false) fmt | ||
in | ||
let assert_lcas_err msg err l2 = | ||
let str = function | ||
| `Too_many_lcas -> "Too_many_lcas" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters