Test: split out test/{p2p,utils}
in various package dir
This commit is contained in:
parent
6205ca9b31
commit
14d902a3fc
33
src/lib_crypto/test/jbuild
Normal file
33
src/lib_crypto/test/jbuild
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
(jbuild_version 1)
|
||||||
|
|
||||||
|
(executables
|
||||||
|
((names (test_merkle))
|
||||||
|
(libraries (tezos-stdlib
|
||||||
|
tezos-error-monad
|
||||||
|
tezos-data-encoding
|
||||||
|
tezos-crypto
|
||||||
|
tezos-test-helpers))
|
||||||
|
(flags (:standard -w -9-32
|
||||||
|
-safe-string
|
||||||
|
-open Tezos_test_helpers
|
||||||
|
-open Tezos_stdlib
|
||||||
|
-open Tezos_error_monad
|
||||||
|
-open Tezos_data_encoding
|
||||||
|
-open Tezos_crypto))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name buildtest)
|
||||||
|
(deps (test_merkle.exe))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest_merkle)
|
||||||
|
(action (run ${exe:test_merkle.exe}))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest)
|
||||||
|
(deps ((alias runtest_merkle)))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest_indent)
|
||||||
|
(deps ((glob_files *.ml) (glob_files *.mli)))
|
||||||
|
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))
|
@ -7,9 +7,8 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
let rec (--) i j =
|
open Error_monad
|
||||||
if j < i then []
|
open Utils.Infix
|
||||||
else i :: (i+1) -- j
|
|
||||||
|
|
||||||
type tree =
|
type tree =
|
||||||
| Empty
|
| Empty
|
33
src/lib_stdlib/test/jbuild
Normal file
33
src/lib_stdlib/test/jbuild
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
(jbuild_version 1)
|
||||||
|
|
||||||
|
(executables
|
||||||
|
((names (test_tzList
|
||||||
|
test_mbytes_buffer))
|
||||||
|
(libraries (tezos-stdlib tezos-test-helpers))
|
||||||
|
(flags (:standard -w -9-32
|
||||||
|
-safe-string
|
||||||
|
-open Tezos_test_helpers
|
||||||
|
-open Tezos_stdlib))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name buildtest)
|
||||||
|
(deps (test_tzList.exe
|
||||||
|
test_mbytes_buffer.exe))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest_tzList)
|
||||||
|
(action (run ${exe:test_tzList.exe}))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest_mbytes_buffer)
|
||||||
|
(action (run ${exe:test_mbytes_buffer.exe}))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest)
|
||||||
|
(deps ((alias runtest_tzList)
|
||||||
|
(alias runtest_mbytes_buffer)))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest_indent)
|
||||||
|
(deps ((glob_files *.ml) (glob_files *.mli)))
|
||||||
|
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))
|
@ -7,6 +7,12 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
|
module Error = struct
|
||||||
|
type error = ..
|
||||||
|
let pp_print_error _ _ = ()
|
||||||
|
end
|
||||||
|
module Test = Tezos_test_helpers.Test.Make(Error)
|
||||||
|
|
||||||
let rec permut = function
|
let rec permut = function
|
||||||
| [] -> [[]]
|
| [] -> [[]]
|
||||||
| x :: xs ->
|
| x :: xs ->
|
||||||
@ -23,32 +29,31 @@ let rec permut = function
|
|||||||
|
|
||||||
let test_take_n _ =
|
let test_take_n _ =
|
||||||
ListLabels.iter (permut [1;2;3;4;5;6;7;8;9]) ~f:begin fun xs ->
|
ListLabels.iter (permut [1;2;3;4;5;6;7;8;9]) ~f:begin fun xs ->
|
||||||
Assert.equal ~msg:__LOC__ (List.take_n ~compare 1 xs) [9]
|
Assert.equal ~msg:__LOC__ (TzList.take_n ~compare 1 xs) [9]
|
||||||
end ;
|
end ;
|
||||||
ListLabels.iter (permut [1;2;3;4;5;6;7;8;9]) ~f:begin fun xs ->
|
ListLabels.iter (permut [1;2;3;4;5;6;7;8;9]) ~f:begin fun xs ->
|
||||||
Assert.equal ~msg:__LOC__ (List.take_n ~compare 3 xs) [7;8;9]
|
Assert.equal ~msg:__LOC__ (TzList.take_n ~compare 3 xs) [7;8;9]
|
||||||
end ;
|
end ;
|
||||||
let inv_compare x y = compare y x in
|
let inv_compare x y = compare y x in
|
||||||
ListLabels.iter (permut [1;2;3;4;5;6;7;8;9]) ~f:begin fun xs ->
|
ListLabels.iter (permut [1;2;3;4;5;6;7;8;9]) ~f:begin fun xs ->
|
||||||
Assert.equal ~msg:__LOC__ (List.take_n ~compare:inv_compare 3 xs) [3;2;1]
|
Assert.equal ~msg:__LOC__ (TzList.take_n ~compare:inv_compare 3 xs) [3;2;1]
|
||||||
end ;
|
end ;
|
||||||
(* less elements than the bound. *)
|
(* less elements than the bound. *)
|
||||||
ListLabels.iter (permut [1;2;3;4;5;6;7;8;9]) ~f:begin fun xs ->
|
ListLabels.iter (permut [1;2;3;4;5;6;7;8;9]) ~f:begin fun xs ->
|
||||||
Assert.equal ~msg:__LOC__ (List.take_n ~compare 12 xs) [1;2;3;4;5;6;7;8;9]
|
Assert.equal ~msg:__LOC__ (TzList.take_n ~compare 12 xs) [1;2;3;4;5;6;7;8;9]
|
||||||
end ;
|
end ;
|
||||||
(* with duplicates. *)
|
(* with duplicates. *)
|
||||||
ListLabels.iter (permut [1;2;3;3;4;5;5;5;6]) ~f:begin fun xs ->
|
ListLabels.iter (permut [1;2;3;3;4;5;5;5;6]) ~f:begin fun xs ->
|
||||||
Assert.equal ~msg:__LOC__ (List.take_n ~compare 3 xs) [5;5;6]
|
Assert.equal ~msg:__LOC__ (TzList.take_n ~compare 3 xs) [5;5;6]
|
||||||
end ;
|
end ;
|
||||||
ListLabels.iter (permut [1;2;3;3;4;5;5;5;6]) ~f:begin fun xs ->
|
ListLabels.iter (permut [1;2;3;3;4;5;5;5;6]) ~f:begin fun xs ->
|
||||||
Assert.equal ~msg:__LOC__ (List.take_n ~compare 5 xs) [4;5;5;5;6]
|
Assert.equal ~msg:__LOC__ (TzList.take_n ~compare 5 xs) [4;5;5;5;6]
|
||||||
end ;
|
end ;
|
||||||
return ()
|
Lwt.return_ok ()
|
||||||
|
|
||||||
let tests : (string * (string -> unit tzresult Lwt.t)) list = [
|
let tests : (string * (string -> (unit, Error.error list) result Lwt.t)) list = [
|
||||||
"take_n", test_take_n ;
|
"take_n", test_take_n ;
|
||||||
]
|
]
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
let module Test = Tezos_test_helpers.Test.Make(Error_monad) in
|
Test.run "tzList." tests
|
||||||
Test.run "utils." tests
|
|
27
src/lib_stdlib_lwt/test/jbuild
Normal file
27
src/lib_stdlib_lwt/test/jbuild
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
(jbuild_version 1)
|
||||||
|
|
||||||
|
(executables
|
||||||
|
((names (test_lwt_pipe))
|
||||||
|
(libraries (tezos-stdlib-lwt tezos-test-helpers))
|
||||||
|
(flags (:standard -w -9-32
|
||||||
|
-safe-string
|
||||||
|
-open Tezos_test_helpers
|
||||||
|
-open Tezos_stdlib_lwt))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name buildtest)
|
||||||
|
(deps (test_lwt_pipe.exe))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest_lwt_pipe)
|
||||||
|
(action (run ${exe:test_lwt_pipe.exe}))))
|
||||||
|
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest)
|
||||||
|
(deps ((alias runtest_lwt_pipe)))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest_indent)
|
||||||
|
(deps ((glob_files *.ml) (glob_files *.mli)))
|
||||||
|
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))
|
@ -1,3 +1,12 @@
|
|||||||
|
(**************************************************************************)
|
||||||
|
(* *)
|
||||||
|
(* Copyright (c) 2014 - 2017. *)
|
||||||
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||||
|
(* *)
|
||||||
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||||
|
(* *)
|
||||||
|
(**************************************************************************)
|
||||||
|
|
||||||
open Lwt.Infix
|
open Lwt.Infix
|
||||||
include Logging.Make (struct let name = "test-pipe" end)
|
include Logging.Make (struct let name = "test-pipe" end)
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
(jbuild_version 1)
|
|
||||||
|
|
||||||
(executables
|
|
||||||
((names (test_lwt_pipe
|
|
||||||
test_merkle
|
|
||||||
test_utils
|
|
||||||
test_mbytes_buffer))
|
|
||||||
(libraries (tezos-base tezos-test-helpers))
|
|
||||||
(flags (:standard -w -9-32
|
|
||||||
-safe-string
|
|
||||||
-open Tezos_base__TzPervasives
|
|
||||||
-open Tezos_test_helpers))))
|
|
||||||
|
|
||||||
(alias
|
|
||||||
((name buildtest)
|
|
||||||
(deps (test_lwt_pipe.exe
|
|
||||||
test_merkle.exe
|
|
||||||
test_utils.exe
|
|
||||||
test_mbytes_buffer.exe))))
|
|
||||||
|
|
||||||
(alias
|
|
||||||
((name runtest_lwt_pipe)
|
|
||||||
(action (run ${exe:test_lwt_pipe.exe}))))
|
|
||||||
|
|
||||||
(alias
|
|
||||||
((name runtest_merkle)
|
|
||||||
(action (run ${exe:test_merkle.exe}))))
|
|
||||||
|
|
||||||
(alias
|
|
||||||
((name runtest_utils)
|
|
||||||
(action (run ${exe:test_utils.exe}))))
|
|
||||||
|
|
||||||
(alias
|
|
||||||
((name runtest_mbytes_buffer)
|
|
||||||
(action (run ${exe:test_mbytes_buffer.exe}))))
|
|
||||||
|
|
||||||
(alias
|
|
||||||
((name runtest)
|
|
||||||
(deps ((alias runtest_lwt_pipe)
|
|
||||||
(alias runtest_merkle)
|
|
||||||
(alias runtest_utils)
|
|
||||||
(alias runtest_mbytes_buffer)))))
|
|
||||||
|
|
||||||
(alias
|
|
||||||
((name runtest_indent)
|
|
||||||
(deps ((glob_files *.ml) (glob_files *.mli)))
|
|
||||||
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))
|
|
Loading…
Reference in New Issue
Block a user