diff options
| author | Marcos Magueta <mmagueta@MacMini.local> | 2024-12-08 12:05:27 -0300 |
|---|---|---|
| committer | Marcos Magueta <mmagueta@MacMini.local> | 2024-12-08 12:05:27 -0300 |
| commit | f43943346e3c6d347b829bbbaeccae5f49327749 (patch) | |
| tree | e1dc5af28e599c64e74affb0c1bc9f8a0132e68d /test | |
| parent | 872fc56a414f8c2a4818463be9e104195a0b6242 (diff) | |
| download | Sakura-f43943346e3c6d347b829bbbaeccae5f49327749.tar.gz Sakura-f43943346e3c6d347b829bbbaeccae5f49327749.zip | |
seq scan initial implementation
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_relational_engine.ml | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/test_relational_engine.ml b/test/test_relational_engine.ml index 65d03d4..3ef4a55 100644 --- a/test/test_relational_engine.ml +++ b/test/test_relational_engine.ml @@ -3,7 +3,7 @@ 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 ((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 @@ -11,7 +11,7 @@ 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 ((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 @@ -22,3 +22,17 @@ let%test _ = print_endline @@ Location.show location; location.size = 3 && location.offset = 0L | None -> false + +let%test _ = + let open Relational_engine.Planner in + match Relational_engine.Relation.write_and_retrieve () with + | Ok (last_commit::_, locations) -> + begin + let (first_names, last_names) = (Scan.execute last_commit locations "user/first-name", Scan.execute last_commit locations "user/last-name") in + let tuples = Join.execute first_names last_names locations in + let tuples = List.map (fun (a, b) -> Bytes.to_string a, Bytes.to_string b) tuples in + List.iter (fun (a, b) -> print_endline (Printf.sprintf "(%s, %s)" a b)) tuples; + true + end + | _ -> + false |
