diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-08-01 01:44:43 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-01 01:44:43 +0000 |
| commit | 117fe888ef9325dbc6965e36c38e40c92d7bc1ee (patch) | |
| tree | 366688654cf0a38b302c22b5151a11f6734dc6d8 /test/unit/backend/Storage.ml | |
| parent | d57288a6143146a99fd1792c543dbade2758ad01 (diff) | |
| parent | b7a09b8c8913b26eb22b98aa77a324a1c23736e2 (diff) | |
| download | RNT-117fe888ef9325dbc6965e36c38e40c92d7bc1ee.tar.gz RNT-117fe888ef9325dbc6965e36c38e40c92d7bc1ee.zip | |
Merge pull request #48 from dont-rely-on-nulls/merkle-tree-tests
Basic tests for the B-tree, and a slightly friendlier storage interface
Diffstat (limited to 'test/unit/backend/Storage.ml')
| -rw-r--r-- | test/unit/backend/Storage.ml | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/test/unit/backend/Storage.ml b/test/unit/backend/Storage.ml index 91db411..76bda8b 100644 --- a/test/unit/backend/Storage.ml +++ b/test/unit/backend/Storage.ml @@ -1,21 +1,9 @@ open Rnt -module type CONFIGURATOR = sig - val configure : string -> Rnt.Concepts.Configuration.term -end - -module Make (S : Abstract.Storage.STORAGE) (C : CONFIGURATOR) = struct +module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = struct open Alcotest - let with_connection f () = - Helpers.with_temporary_directory "storage-test" begin fun dir -> - begin - let open Utilities.Result in - let* conn = S.connect (C.configure dir) in - Ok (f conn) - end - |> Helpers.condition_as_failure - end + module H = Helpers.Storage.Make (S) (C) let storage_and_retrieval conn = let key = Concepts.Hash.hash_of_value (Concepts.Value.String "value") in @@ -38,16 +26,9 @@ module Make (S : Abstract.Storage.STORAGE) (C : CONFIGURATOR) = struct let suite prefix = ( "storage/" ^ prefix, - [test_case "storage-and-retrieval" `Quick (with_connection storage_and_retrieval)] ) -end - -module LMDB_Configurator : CONFIGURATOR = struct - let configure base = - let open Sexplib.Sexp in - List [Atom "lmdb"; List [Atom "path"; Atom base]; List [Atom "mode"; Atom "420"]] - |> Rnt.Concepts.Configuration.term_of_sexp + [test_case "storage-and-retrieval" `Quick (H.with_connection storage_and_retrieval "storage-test")] ) end -module LMDB = Make (Rnt.Backend.Storage.LMDB) (LMDB_Configurator) +module LMDB = Make (Rnt.Backend.Storage.LMDB) (Helpers.Storage.LMDB_Configurator) let suites () = [LMDB.suite "lmdb"] |
