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_cvere_poke.ml | |
parent | fdab65f6dac4ba85ed4749f61970660d1132d453 (diff) |
cleaned up tests
Diffstat (limited to 'ocaml/test/test_cvere_poke.ml')
-rw-r--r-- | ocaml/test/test_cvere_poke.ml | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/ocaml/test/test_cvere_poke.ml b/ocaml/test/test_cvere_poke.ml deleted file mode 100644 index 28b0c78..0000000 --- a/ocaml/test/test_cvere_poke.ml +++ /dev/null @@ -1,105 +0,0 @@ -(* Test C Vere Poke Pattern - * - * Implement the exact poke sequence from C Vere: - * 1. Get slot 23 from Arvo core (poke formula) - * 2. Run Nock to compute the poke gate - * 3. Slam: build [battery [event context]] and call arm 2 - *) - -open Nock_lib - -let slam_on gate event = - (* C Vere slam_on: u3nc(u3k(u3h(gat)), u3nc(sam, u3k(u3t(u3t(gat))))) *) - (* Build: [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: call arm 2 *) - 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 test_cvere_poke env = - Printf.printf "šÆ Testing C Vere Poke Pattern\n\n"; - - Eio.Switch.run @@ fun _sw -> - let fs = Eio.Stdenv.fs env in - - (* Load ivory pill *) - let state = State.create () in - match Boot.boot_from_file ~fs state "ivory.pill" with - | Error msg -> - Printf.printf "ā Failed to load pill: %s\n%!" msg - | Ok () -> - let pill_root = State.get_arvo state in - - Printf.printf "Step 0: Navigate to real Arvo core\n"; - Printf.printf " Path: [3 3 2 3 2 3 3 2]\n"; - - (* Navigate to real Arvo *) - let path = [3; 3; 2; 3; 2; 3; 3; 2] in - let rec navigate noun = function - | [] -> noun - | slot :: rest -> - navigate (Noun.slot (Z.of_int slot) noun) rest - in - let arvo = navigate pill_root path in - Printf.printf " ā Found real Arvo core\n\n"; - - Printf.printf "Step 1: Get slot 23 from Arvo core\n"; - let slot_23_formula = Noun.slot (Z.of_int 23) arvo in - Printf.printf " ā Got formula from slot 23\n\n"; - - Printf.printf "Step 2: Run Nock to compute poke gate\n"; - Printf.printf " Subject: Arvo core\n"; - Printf.printf " Formula: slot 23 contents\n"; - - let poke_gate = Nock.nock_on arvo slot_23_formula in - Printf.printf " ā Computed poke gate\n\n"; - - Printf.printf "Step 3: Create test event (ovum)\n"; - let event = Noun.cell (Noun.atom 0) (Noun.atom 42) in - Printf.printf " Event: [0 42]\n\n"; - - Printf.printf "Step 4: Slam poke gate with event\n"; - Printf.printf " Building: [battery [event context]]\n"; - Printf.printf " Calling: arm 2\n\n"; - - let start = Unix.gettimeofday () in - (try - let result = slam_on poke_gate event in - let elapsed = Unix.gettimeofday () -. start in - - Printf.printf "š POKE SUCCEEDED in %.4fs!\n\n" elapsed; - - (* Result should be [effects new-core] *) - if Noun.is_cell result then begin - Printf.printf "Result structure: Cell\n"; - let effects = Noun.head result in - let new_core = Noun.tail result in - - Printf.printf " Effects: %s\n" - (if Noun.is_cell effects then "Cell (list)" else "Atom"); - Printf.printf " New core: %s\n" - (if Noun.is_cell new_core then "Cell (updated Arvo)" else "Atom"); - - Printf.printf "\n⨠ARVO IS RUNNING!\n"; - Printf.printf "We can now poke Arvo with events!\n" - end else - Printf.printf "Result is atom (unexpected)\n" - - with e -> - Printf.printf "ā Poke failed: %s\n" (Printexc.to_string e); - Printf.printf "Stack trace:\n%s\n" (Printexc.get_backtrace ())) - -let () = - Printf.printf "\n"; - Printf.printf "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n"; - Printf.printf " Testing C Vere Poke Pattern on Arvo\n"; - Printf.printf "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n"; - Printf.printf "\n"; - - Eio_main.run test_cvere_poke |