From fcb5613755b08fcb7ae73a3826b1cdce40e2747f Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Sun, 27 Oct 2024 01:53:18 -0300 Subject: State of the world with Merkle Tree composition of files (#2) * file state hash calculation with history on replace and insert * add state transitions with linear hashing * add test * format dune files * nix format * delete shared flake * disable fmt check on flake * add nix formatter to flake shell --- test/dune | 8 ++++++-- test/test_relational_engine.ml | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/dune b/test/dune index 8f2e6a4..2f3e5eb 100644 --- a/test/dune +++ b/test/dune @@ -1,2 +1,6 @@ -(test - (name test_relational_engine)) +(library + (name test_relational_engine) + (libraries relational_engine) + (inline_tests) + (preprocess + (pps ppx_inline_test))) diff --git a/test/test_relational_engine.ml b/test/test_relational_engine.ml index e69de29..69a7df2 100644 --- a/test/test_relational_engine.ml +++ b/test/test_relational_engine.ml @@ -0,0 +1,8 @@ + +let%test _ = + let open Relational_engine.Disk.Executor in + let stream: history = [{state = _EMPTY_SHA_HASH_; files = StringMap.empty}] in + let locations: locations = StringMap.empty in + let (new_commit, _) = Result.get_ok @@ write (List.hd stream) locations ~filename:"trash" @@ Bytes.of_string "abc" in + let expected_state_hash = "bca39cc55b19274133ce57d0bea1ff794589f025d4bcf670c44d5d2811837830" in + new_commit.state = expected_state_hash -- cgit v1.2.3