diff options
author | polwex <polwex@sortug.com> | 2025-10-06 23:18:59 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-10-06 23:18:59 +0700 |
commit | 5de3f7a3ad7b0cf63b4a6cbddfc1e26359dea161 (patch) | |
tree | b55b2258123149bed40bd89bbaa58e7da54f3a26 /ocaml/test/test_solid_cvere_pattern.ml | |
parent | fdab65f6dac4ba85ed4749f61970660d1132d453 (diff) |
cleaned up tests
Diffstat (limited to 'ocaml/test/test_solid_cvere_pattern.ml')
-rw-r--r-- | ocaml/test/test_solid_cvere_pattern.ml | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/ocaml/test/test_solid_cvere_pattern.ml b/ocaml/test/test_solid_cvere_pattern.ml deleted file mode 100644 index a0a4c58..0000000 --- a/ocaml/test/test_solid_cvere_pattern.ml +++ /dev/null @@ -1,129 +0,0 @@ -(* Test C Vere poke pattern on solid pill *) - -open Nock_lib - -let slam_on gate event = - (* C Vere slam_on: [battery [new-sample context]] *) - let battery = Noun.head gate in - let context = Noun.tail (Noun.tail gate) in (* slot 7 *) - let new_core = Noun.cell battery (Noun.cell event context) in - - (* Kick arm 2: [9 2 0 1] *) - let kick_formula = Noun.cell (Noun.atom 9) - (Noun.cell (Noun.atom 2) - (Noun.cell (Noun.atom 0) (Noun.atom 1))) in - - Nock.nock_on new_core kick_formula - -let rec to_list acc noun = - match noun with - | Noun.Atom _ -> List.rev acc - | Noun.Cell (item, rest) -> to_list (item :: acc) rest - -let test_poke _env = - Printf.printf "šÆ Testing C Vere Pattern on Solid Pill\n\n"; - - (* Load solid pill *) - Printf.printf "Loading solid pill...\n"; - let in_channel = open_in_bin "solid.noun" in - let pill = (Marshal.from_channel in_channel : Noun.noun) in - close_in in_channel; - - match pill with - | Noun.Cell (_tag, events) -> - let event_list = to_list [] events in - Printf.printf "Found %d events\n\n" (List.length event_list); - - (* Event 1 is the initial kernel *) - begin match List.nth_opt event_list 1 with - | Some kernel -> - Printf.printf "Testing on Event 1 (initial kernel):\n\n"; - - (* Try slot 23 (C Vere pattern) *) - Printf.printf "Step 1: Get formula from slot 23...\n"; - begin try - let slot_23_formula = Noun.slot (Z.of_int 23) kernel in - Printf.printf " ā Found formula at slot 23\n\n"; - - Printf.printf "Step 2: Run formula to compute poke gate...\n"; - let poke_gate = Nock.nock_on kernel slot_23_formula in - Printf.printf " ā Computed poke gate\n\n"; - - Printf.printf "Step 3: Build test event...\n"; - (* Build proper ovum: [wire card] *) - let wire = Noun.atom 0 in - let card = Noun.cell (Noun.atom 1953719668) (Noun.atom 42) in - let ovum = Noun.cell wire card in - - (* Build poke args: [now ovum] *) - let now = Noun.atom 0 in - let event = Noun.cell now ovum in - Printf.printf " Event: [now [wire card]]\n\n"; - - Printf.printf "Step 4: Slam poke gate...\n"; - let start = Unix.gettimeofday () in - let result = slam_on poke_gate event in - let elapsed = Unix.gettimeofday () -. start in - - Printf.printf " ā Poke succeeded in %.4fs!\n\n" elapsed; - - begin match result with - | Noun.Cell (_effects, _new_kernel) -> - Printf.printf "Result: [effects new-kernel]\n"; - Printf.printf " ā Got expected structure!\n\n"; - Printf.printf "š SOLID PILL ARVO IS WORKING!\n" - | Noun.Atom _ -> - Printf.printf "Result is atom (unexpected)\n" - end - - with - | Noun.Exit -> - Printf.printf " ā Nock failed (Exit)\n\n"; - - (* Try slot 42 instead *) - Printf.printf "Trying slot 42 instead...\n"; - begin try - let slot_42 = Noun.slot (Z.of_int 42) kernel in - Printf.printf " ā Found something at slot 42\n"; - - (* Check if it's a formula or a gate *) - Printf.printf " Attempting to use as formula...\n"; - let poke_gate = Nock.nock_on kernel slot_42 in - Printf.printf " ā Computed gate from slot 42\n\n"; - - let wire = Noun.atom 0 in - let card = Noun.cell (Noun.atom 1953719668) (Noun.atom 42) in - let ovum = Noun.cell wire card in - let now = Noun.atom 0 in - let event = Noun.cell now ovum in - - let result = slam_on poke_gate event in - Printf.printf " ā Poke with slot 42 succeeded!\n\n"; - - begin match result with - | Noun.Cell _ -> - Printf.printf "š SLOT 42 WORKS!\n" - | Noun.Atom _ -> - Printf.printf "Result is atom\n" - end - - with - | Noun.Exit -> Printf.printf " ā Slot 42 also failed\n" - | Not_found -> Printf.printf " ā No slot 42\n" - end - | Not_found -> - Printf.printf " ā No slot 23 found\n" - end - - | None -> - Printf.printf "ā No event 1\n" - end - - | Noun.Atom _ -> - Printf.printf "ā Pill is atom\n" - -let () = - Printf.printf "\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n"; - Printf.printf " Test C Vere Pattern on Solid Pill\n"; - Printf.printf "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n\n"; - Eio_main.run test_poke |