diff --git a/manifest/main.ml b/manifest/main.ml index b5f25355111ea9b71d476513d4e3effd229ca65d..37bf856714089d3e9bdf8dc608c3d339a44ea07a 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -1254,19 +1254,18 @@ let lazy_containers = ~deps:[octez_lwt_result_stdlib; zarith] let _lazy_containers_tests = - test - "main" + tezt + ["chunked_byte_vector_tests"; "lazy_vector_tests"] ~path:"src/lib_lazy_containers/test" ~opam:"tezos-lazy-containers-tests" ~synopsis:"Various tests for the lazy containers library" - ~dune:Dune.[[S "include_subdirs"; S "no"]] ~deps: [ lazy_containers |> open_; qcheck_core; qcheck_alcotest; - alcotest; lwt_unix; + alcotezt; ] let tree_encoding = diff --git a/opam/tezos-lazy-containers-tests.opam b/opam/tezos-lazy-containers-tests.opam index 6a8112667da3a1b633c3afdb72fb59063f3aca5f..693fcef3a9db923d1c1477c3e701a0c09e295336 100644 --- a/opam/tezos-lazy-containers-tests.opam +++ b/opam/tezos-lazy-containers-tests.opam @@ -10,15 +10,17 @@ license: "MIT" depends: [ "dune" { >= "3.0" } "ocaml" { >= "4.14" } + "tezt" { with-test & >= "3.0.0" } "tezos-lazy-containers" {with-test} "qcheck-core" {with-test} "qcheck-alcotest" { with-test & >= "0.20" } - "alcotest" { with-test & >= "1.5.0" } "lwt" { with-test & >= "5.6.0" } + "octez-alcotezt" {with-test} ] build: [ ["rm" "-r" "vendors"] ["dune" "build" "-p" name "-j" jobs] ["dune" "runtest" "-p" name "-j" jobs] {with-test} + ["dune" "build" "@runtezt" "-p" name "-j" jobs] {with-test} ] synopsis: "Various tests for the lazy containers library" diff --git a/src/lib_lazy_containers/test/chunked_byte_vector_tests.ml b/src/lib_lazy_containers/test/chunked_byte_vector_tests.ml index a2b5a8fee7f43c77396c57948116d39e8f15bb15..36ac169261900a2d1c74b9fecfcfb0790f681248 100644 --- a/src/lib_lazy_containers/test/chunked_byte_vector_tests.ml +++ b/src/lib_lazy_containers/test/chunked_byte_vector_tests.ml @@ -297,3 +297,5 @@ module Immutable_CBV = Tests (struct end) let tests = List.concat [Mutable_CBV.all_tests; Immutable_CBV.all_tests] + +let () = Alcotest.run "Chunked_byte_vector" [("Chunked_byte_vector", tests)] diff --git a/src/lib_lazy_containers/test/dune b/src/lib_lazy_containers/test/dune index 5dc42da06b7b3ff758b4ec6ae0151fec31c4cfc5..e9f31b4fd69d7eed3264da5e436068f64e5dfeb0 100644 --- a/src/lib_lazy_containers/test/dune +++ b/src/lib_lazy_containers/test/dune @@ -1,21 +1,37 @@ ; This file was automatically generated, do not edit. ; Edit file manifest/main.ml instead. -(executable - (name main) +(library + (name src_lib_lazy_containers_test_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries + tezt.core tezos-lazy-containers qcheck-core qcheck-alcotest - alcotest - lwt.unix) + lwt.unix + octez-alcotezt) + (library_flags (:standard -linkall)) (flags (:standard) - -open Tezos_lazy_containers)) + -open Tezt_core + -open Tezt_core.Base + -open Tezos_lazy_containers + -open Octez_alcotezt) + (modules chunked_byte_vector_tests lazy_vector_tests)) + +(executable + (name main) + (libraries + src_lib_lazy_containers_test_tezt_lib + tezt) + (modules main)) (rule - (alias runtest) + (alias runtezt) (package tezos-lazy-containers-tests) (action (run %{dep:./main.exe}))) -(include_subdirs no) +(rule + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) diff --git a/src/lib_lazy_containers/test/lazy_vector_tests.ml b/src/lib_lazy_containers/test/lazy_vector_tests.ml index 97705ee2a0425a8901f9b3b70a64e50cf623e686..92f0e9849e74868521dfb15eb7ce75a203180752 100644 --- a/src/lib_lazy_containers/test/lazy_vector_tests.ml +++ b/src/lib_lazy_containers/test/lazy_vector_tests.ml @@ -136,19 +136,11 @@ let concat_works () = Lwt_main.run @@ let map1 = - IntVector.create - ~produce_value:(fun x -> - Printf.printf "> map1: %i\n%!" x ; - Lwt.return @@ Int.succ x) - 1 + IntVector.create ~produce_value:(fun x -> Lwt.return @@ Int.succ x) 1 |> IntVector.cons 10 in let map2 = - IntVector.create - ~produce_value:(fun x -> - Printf.printf "> map2: %i\n%!" x ; - Lwt.return @@ Int.pred x) - 1 + IntVector.create ~produce_value:(fun x -> Lwt.return @@ Int.pred x) 1 |> IntVector.cons 20 in let* map = IntVector.concat map1 map2 in @@ -254,3 +246,5 @@ let tests = ("concat works lazily", `Quick, concat_works); ("check size overflow", `Quick, check_overflow); ] + +let () = Alcotest.run "Lazy structs tests" [("Lazy_vector", tests)] diff --git a/src/lib_lazy_containers/test/main.ml b/src/lib_lazy_containers/test/main.ml deleted file mode 100644 index 5ef4abf5c62ba7b5c13451eab55bf377baea0b8a..0000000000000000000000000000000000000000 --- a/src/lib_lazy_containers/test/main.ml +++ /dev/null @@ -1,32 +0,0 @@ -(*****************************************************************************) -(* *) -(* Open Source License *) -(* Copyright (c) 2022 Trili Tech *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) -(* *) -(*****************************************************************************) - -let tests = - [ - ("Lazy_vector", Lazy_vector_tests.tests); - ("Chunked_byte_vector", Chunked_byte_vector_tests.tests); - ] - -let () = Alcotest.run "Lazy structs tests" tests diff --git a/tezt/tests/dune b/tezt/tests/dune index 6029b9ee3d17db30e32e5a971bd023ace03f7965..7eaaffb5d250c101109cbb8909156516b1aac929 100644 --- a/tezt/tests/dune +++ b/tezt/tests/dune @@ -21,6 +21,7 @@ src_lib_stdlib_test_tezt_lib src_lib_p2p_tezt_tezt_lib src_lib_lwt_result_stdlib_test_tezt_lib + src_lib_lazy_containers_test_tezt_lib src_lib_error_monad_test_tezt_lib src_lib_benchmark_test_tezt_lib src_lib_base_test_tezt_lib)