diff options
| author | Marcos Magueta <mmagueta@MacMini.local> | 2024-11-24 18:34:17 -0300 |
|---|---|---|
| committer | Marcos Magueta <mmagueta@MacMini.local> | 2024-11-24 18:34:17 -0300 |
| commit | c310cdc8d684a89e24b8b5910e39c4894b60c7c0 (patch) | |
| tree | e87a5663c093cb29be398161f0ac54fc9beef703 /test | |
| parent | 1f4a38355e33ae8fec6bcc82d12ac8c42831e636 (diff) | |
| download | Sakura-c310cdc8d684a89e24b8b5910e39c4894b60c7c0.tar.gz Sakura-c310cdc8d684a89e24b8b5910e39c4894b60c7c0.zip | |
write and read from disk
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_relational_engine.ml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_relational_engine.ml b/test/test_relational_engine.ml index 69a7df2..cc9652b 100644 --- a/test/test_relational_engine.ml +++ b/test/test_relational_engine.ml @@ -6,3 +6,19 @@ let%test _ = 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 + +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, new_locations) = Result.get_ok @@ write (List.hd stream) locations ~filename:"trash" @@ Bytes.of_string "abc" in + let result_test = + let open Relational_engine.Extensions.Option in + let+ new_file_content = StringMap.find_opt "trash" new_commit.files in + let { values; _ }: Hashes.t = List.hd new_file_content in + StringMap.find_opt (List.hd values) new_locations + in match result_test with + | Some location -> + print_endline @@ Location.show location; + location.size = 3 && location.offset = 0L + | None -> false |
