diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-25 21:51:33 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-25 21:51:33 -0300 |
| commit | 584fbca6d920e9a9f91d451667f9380714ac2175 (patch) | |
| tree | a163b916a6f8cb550c8b38ceb01ab01558687a40 /test/unit/evaluators | |
| parent | c7b754e96714eeeb9d315ee3de402d73a27d47db (diff) | |
| download | RNT-584fbca6d920e9a9f91d451667f9380714ac2175.tar.gz RNT-584fbca6d920e9a9f91d451667f9380714ac2175.zip | |
dune fmt
Diffstat (limited to '')
| -rw-r--r-- | test/unit/evaluators/FOL.ml | 15 | ||||
| -rw-r--r-- | test/unit/evaluators/Lambda.ml | 39 |
2 files changed, 21 insertions, 33 deletions
diff --git a/test/unit/evaluators/FOL.ml b/test/unit/evaluators/FOL.ml index 9cfeb84..404e7a4 100644 --- a/test/unit/evaluators/FOL.ml +++ b/test/unit/evaluators/FOL.ml @@ -2,15 +2,13 @@ open Rnt module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = struct open Alcotest - module H = Helpers.Storage.Make (S) (C) module SR = Rnt.Kernel.SubstantialRelation.Make (S) let alaric = - { Concepts.Tuple.type_ = "employee"; - attributes = - BatMap.String.empty - |> BatMap.String.add "name" (Concepts.Value.String "Alaric") } + { Concepts.Tuple.type_= "employee"; + attributes= BatMap.String.empty |> BatMap.String.add "name" (Concepts.Value.String "Alaric") + } let not_a_directory () = Concepts.Condition.condition "not-a-directory" @@ -41,8 +39,7 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let* found = Protocols.Directory.find directory "fol" in let* evaluator = Option.to_result ~none:(not_a_program ()) found in let* interpreter = - Rnt.Evaluators.FOL.Program.from evaluator - |> Option.to_result ~none:(not_a_program ()) + Rnt.Evaluators.FOL.Program.from evaluator |> Option.to_result ~none:(not_a_program ()) in let* cursor = Rnt.Evaluators.FOL.Program.invoke interpreter (Rnt.Evaluators.FOL.Base employee) @@ -58,8 +55,8 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = check bool "the tuple that was asserted" true (List.for_all (fun tuple -> - Concepts.Hash.hash_equals (Concepts.Tuple.hash tuple) (Concepts.Tuple.hash alaric)) - scanned) + Concepts.Hash.hash_equals (Concepts.Tuple.hash tuple) (Concepts.Tuple.hash alaric) ) + scanned ) let suite prefix = ( "fol/" ^ prefix, diff --git a/test/unit/evaluators/Lambda.ml b/test/unit/evaluators/Lambda.ml index 5866411..ee15c16 100644 --- a/test/unit/evaluators/Lambda.ml +++ b/test/unit/evaluators/Lambda.ml @@ -2,21 +2,18 @@ open Rnt module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = struct open Alcotest - module H = Helpers.Storage.Make (S) (C) module SR = Rnt.Kernel.SubstantialRelation.Make (S) let datum = - { Concepts.Tuple.type_ = "noun"; - attributes = - BatMap.String.empty - |> BatMap.String.add "lemma" (Concepts.Value.String "datum") } + { Concepts.Tuple.type_= "noun"; + attributes= BatMap.String.empty |> BatMap.String.add "lemma" (Concepts.Value.String "datum") + } let reticulare = - { Concepts.Tuple.type_ = "verb"; - attributes = - BatMap.String.empty - |> BatMap.String.add "lemma" (Concepts.Value.String "rēticulāre") } + { Concepts.Tuple.type_= "verb"; + attributes= + BatMap.String.empty |> BatMap.String.add "lemma" (Concepts.Value.String "rēticulāre") } let not_a_directory () = Concepts.Condition.condition "not-a-directory" @@ -48,18 +45,13 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = [ Kernel.Prototype.Directory.of_properties ["noun", noun; "verb", verb; "lambda", Rnt.Evaluators.Lambda.make ()] ] in - let* directory = - Protocols.Directory.from root |> Option.to_result ~none:(not_a_directory ()) - in + let* directory = Protocols.Directory.from root |> Option.to_result ~none:(not_a_directory ()) in let* found = Protocols.Directory.find directory "lambda" in let* evaluator = Option.to_result ~none:(not_a_program ()) found in let* interpreter = - Rnt.Evaluators.Lambda.Program.from evaluator - |> Option.to_result ~none:(not_a_program ()) - in - let* cursor = - Rnt.Evaluators.Lambda.(Program.invoke interpreter (Program (term, directory))) + Rnt.Evaluators.Lambda.Program.from evaluator |> Option.to_result ~none:(not_a_program ()) in + let* cursor = Rnt.Evaluators.Lambda.(Program.invoke interpreter (Program (term, directory))) in let* scan = Protocols.Cursor.require cursor in let* tuples = Protocols.Cursor.drain scan () in Protocols.Handle.release cursor; @@ -81,8 +73,7 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let identity_applied_to_a_relation conn = let open Rnt.Evaluators.Lambda in let scanned = - evaluate conn (Apply (Abstract ("x", Name "x"), Name "noun")) - |> Helpers.condition_as_failure + evaluate conn (Apply (Abstract ("x", Name "x"), Name "noun")) |> Helpers.condition_as_failure in check int "one tuple scanned" 1 (List.length scanned); check bool "the tuple that was asserted" true (List.for_all (is datum) scanned) @@ -94,8 +85,8 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let scanned = evaluate conn (Apply - ( Apply (Abstract ("x", Abstract ("y", Name "x")), Name "noun"), - Abstract ("z", Name "z") )) + (Apply (Abstract ("x", Abstract ("y", Name "x")), Name "noun"), Abstract ("z", Name "z")) + ) |> Helpers.condition_as_failure in check int "one tuple scanned" 1 (List.length scanned); @@ -124,9 +115,9 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let open Rnt.Evaluators.Lambda in match evaluate conn (Abstract ("x", Name "x")) with | Error condition -> - check bool "unapplied abstraction" true - (String.starts_with ~prefix:"unapplied-abstraction" - (Concepts.Condition.to_string_hum condition)) + check bool "unapplied abstraction" true + (String.starts_with ~prefix:"unapplied-abstraction" + (Concepts.Condition.to_string_hum condition) ) | Ok _ -> fail "an abstraction was enumerated" let suite prefix = |
