From b2ff91614a7f1c7dd54a43bbfe88bbb6694b0a71 Mon Sep 17 00:00:00 2001 From: Estevan Castilho Date: Sat, 24 Oct 2026 01:50:35 +0000 Subject: Formatting --- test/integration/Registration.ml | 3 +-- test/unit/evaluators/FOL.ml | 15 +++++++++------ test/unit/kernel/Branch.ml | 18 +++++++++++------- test/unit/kernel/EphemeralRelation.ml | 8 ++++++-- test/unit/kernel/Merkle.ml | 15 +++------------ test/unit/kernel/Session.ml | 4 +++- 6 files changed, 33 insertions(+), 30 deletions(-) (limited to 'test') diff --git a/test/integration/Registration.ml b/test/integration/Registration.ml index 6f308cd..7c7cfba 100644 --- a/test/integration/Registration.ml +++ b/test/integration/Registration.ml @@ -59,8 +59,7 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = end |> Helpers.condition_as_failure in - check (list string) "the stored program reads the book it was defined over" ["title"] - attributes; + check (list string) "the stored program reads the book it was defined over" ["title"] attributes; check (list Helpers.value) "read through the branch, the stored program runs" [Concepts.Value.String "SQL and Relational Theory"] shelved diff --git a/test/unit/evaluators/FOL.ml b/test/unit/evaluators/FOL.ml index 0deb71d..4a6cadd 100644 --- a/test/unit/evaluators/FOL.ml +++ b/test/unit/evaluators/FOL.ml @@ -21,7 +21,10 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let employees = Rnt.Evaluators.FOL.Base Kernel.Path.("employee" @/ this) let names = Rnt.Evaluators.FOL.Project (employees, BatFingerTree.singleton "name") - let heading = BatMap.String.singleton "name" {Protocols.Schematics.domain= "string"; provenance= []} + + let heading = + BatMap.String.singleton "name" {Protocols.Schematics.domain= "string"; provenance= []} + let directory entries = Kernel.Prototype.(mixture [Directory.of_properties entries]) let eval within term = @@ -116,9 +119,7 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let* relation = H.relation conn ["name"; "age"] [employee "Alaric" 42] in let* stored = store conn names in let* root = namespace ["employee", relation; "stored", stored] in - let* plan = - Rnt.Evaluators.FOL.(instantiate root (Base Kernel.Path.("stored" @/ this))) - in + let* plan = Rnt.Evaluators.FOL.(instantiate root (Base Kernel.Path.("stored" @/ this))) in let* result = Rnt.Evaluators.FOL.execute plan in drain result end @@ -217,7 +218,8 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = (Kernel.EphemeralRelation.temporary description) (fun () -> Ok (Kernel.Generator.cursor_of ~finally:(fun () -> closed := true) (count 0))) - let values source = Rnt.Evaluators.FOL.(execute (Project (Base source, BatFingerTree.singleton "value"))) + let values source = + Rnt.Evaluators.FOL.(execute (Project (Base source, BatFingerTree.singleton "value"))) let pull_one_tuple_at_a_time () = let produced = ref 0 and closed = ref false in @@ -248,7 +250,8 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = check bool "it fails as undecidable instead of reading without end" true ( match asked with | Error condition -> - BatString.starts_with (Concepts.Condition.to_string_hum condition) + BatString.starts_with + (Concepts.Condition.to_string_hum condition) "undecidable-membership" | Ok _ -> false ) diff --git a/test/unit/kernel/Branch.ml b/test/unit/kernel/Branch.ml index d92a6d7..a0f201d 100644 --- a/test/unit/kernel/Branch.ml +++ b/test/unit/kernel/Branch.ml @@ -10,10 +10,8 @@ let under a b = K.Path.(of_list (to_list a @ to_list b)) let shelf = K.Scope.path library "shelf" let s v = C.Value.String v let title = BatMap.String.singleton "title" {P.Schematics.domain= "string"; provenance= []} - let book t = {C.Tuple.type_= "book"; attributes= BatMap.String.singleton "title" (s t)} let books titles = K.EphemeralRelation.literal title (List.map book titles) - let titles relation = ok (Helpers.titles relation) let read root path = titles (ok (K.Path.lookup root path)) @@ -118,7 +116,10 @@ let endless () = (fun () -> Ok (K.Generator.cursor_of (fun ~yield -> - let rec from n = yield (book (string_of_int n)); from (n + 1) in + let rec from n = + yield (book (string_of_int n)); + from (n + 1) + in from 0 ) ) ) (* A toy language: "endless" answers titles without end, "shout r" the @@ -162,7 +163,9 @@ let with_toys ?evaluations root = ignore (ok (K.Initialization.mount root "toys")); ignore (ok - (K.Path.update root K.Path.("toys" @/ "evaluator" @/ this) "toy" None + (K.Path.update root + K.Path.("toys" @/ "evaluator" @/ this) + "toy" None (Some (toy ?evaluations ())) ) ) let toy_program ?root evaluator source = K.Program.make ?root ~evaluator ~source (parse source) @@ -174,8 +177,7 @@ let run root program = let a_program_runs_through_the_evaluator_it_names () = let root = fresh ["Codd"] in with_toys root; - publish root - ["named", Some (K.EphemeralRelation.of_program title (toy_program "toys:toy" "this"))]; + publish root ["named", Some (K.EphemeralRelation.of_program title (toy_program "toys:toy" "this"))]; check (list Helpers.value) "stored in a branch and read back, it runs" [s "this"] (read root (under master (K.Scope.path library "named"))); @@ -236,7 +238,9 @@ let a_denial_without_end_cannot_be_installed () = let root = fresh [] in with_toys root; let endless = K.EphemeralRelation.of_program title (toy_program "toys:toy" "endless") in - match K.Scope.publish root ~branch:"master" ~home:library ~denials:["endless", Some endless] [] with + match + K.Scope.publish root ~branch:"master" ~home:library ~denials:["endless", Some endless] [] + with | Ok () -> fail "a denial without end was installed" | Error condition -> check bool "the state holding it cannot be judged" true diff --git a/test/unit/kernel/EphemeralRelation.ml b/test/unit/kernel/EphemeralRelation.ml index 151f8fc..9426b9a 100644 --- a/test/unit/kernel/EphemeralRelation.ml +++ b/test/unit/kernel/EphemeralRelation.ml @@ -25,7 +25,10 @@ let endless () = (fun () -> Ok (Rnt.Kernel.Generator.cursor_of (fun ~yield -> - let rec from n = yield (member n); from (n + 1) in + let rec from n = + yield (member n); + from (n + 1) + in from 0 ) ) ) let values tuples = @@ -72,7 +75,8 @@ let refuses_to_scan_without_end () = match Protocols.Relation.contains relation (member 9) with | Error condition -> check bool "it fails as undecidable instead of scanning" true - (BatString.starts_with (Concepts.Condition.to_string_hum condition) + (BatString.starts_with + (Concepts.Condition.to_string_hum condition) "undecidable-membership" ) | Ok _ -> fail "an endless relation with no test decided membership" ) diff --git a/test/unit/kernel/Merkle.ml b/test/unit/kernel/Merkle.ml index b0d4e03..6ac0f63 100644 --- a/test/unit/kernel/Merkle.ml +++ b/test/unit/kernel/Merkle.ml @@ -14,10 +14,7 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let open Utilities.Result in let* tx = S.start conn in let* node = - T.empty - |> T.insert tx "k1" "v1" - |>> T.insert tx "k2" "v2" - |>> T.insert tx "k3" "v3" + T.empty |> T.insert tx "k1" "v1" |>> T.insert tx "k2" "v2" |>> T.insert tx "k3" "v3" in let* node' = T.insert tx "k3" "toodles" node in let* v1 = T.lookup tx "k1" node in @@ -73,10 +70,7 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let open Utilities.Result in let* tx = S.start conn in let* node = - T.empty - |> T.insert tx "k1" "v1" - |>> (T.insert tx "k2" "v2") - |>> (T.insert tx "k3" "v3") + T.empty |> T.insert tx "k1" "v1" |>> T.insert tx "k2" "v2" |>> T.insert tx "k3" "v3" in let* () = S.commit tx in Ok (T.hash_of node) @@ -105,10 +99,7 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let open Utilities.Result in let* tx = S.start conn in let* node = - T.empty - |> T.insert tx "k1" "v1" - |>> (T.insert tx "k2" "v2") - |>> (T.insert tx "k3" "v3") + T.empty |> T.insert tx "k1" "v1" |>> T.insert tx "k2" "v2" |>> T.insert tx "k3" "v3" in let* keys = T.fold_left tx (fun acc k _ -> k :: acc) [] node |> Result.map List.rev in let* values = T.fold_left tx (fun acc _ v -> v :: acc) [] node |> Result.map List.rev in diff --git a/test/unit/kernel/Session.ml b/test/unit/kernel/Session.ml index 0665985..4ce5b23 100644 --- a/test/unit/kernel/Session.ml +++ b/test/unit/kernel/Session.ml @@ -25,7 +25,9 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let* _ = update root ("system" @/ "branch" @/ this) "client" None (Some branch) in let* tip = address branch in let session = Session.make conn {Protocols.Session.snapshot= tip} in - let* _ = update root ("system" @/ "session" @/ this) "client" None (Protocols.Handle.copy session) in + let* _ = + update root ("system" @/ "session" @/ this) "client" None (Protocols.Handle.copy session) + in let library = "system" @/ "session" @/ "client" @/ "branch" @/ "multigroup" @/ "library" @/ this in -- cgit v1.2.3