From 4be1d7f999ffb3eb1c12c54e863b141af21b3fbf Mon Sep 17 00:00:00 2001 From: polwex Date: Mon, 6 Oct 2025 10:30:19 +0700 Subject: some progress but man --- ocaml/test/test_arms.ml | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 ocaml/test/test_arms.ml (limited to 'ocaml/test/test_arms.ml') diff --git a/ocaml/test/test_arms.ml b/ocaml/test/test_arms.ml new file mode 100644 index 0000000..0847f6f --- /dev/null +++ b/ocaml/test/test_arms.ml @@ -0,0 +1,73 @@ +(* Test Different Arms + * + * Try calling different arms of the Arvo kernel + *) + +open Nock_lib + +let test_arm arm_num kernel = + Printf.printf "Testing arm %d: " arm_num; + + try + let formula = Noun.cell (Noun.atom 9) + (Noun.cell (Noun.atom arm_num) + (Noun.cell (Noun.atom 0) (Noun.atom 1))) in + + let _result = Nock.nock_on kernel formula in + Printf.printf "✓ Success!\n"; + true + with e -> + Printf.printf "✗ %s\n" (Printexc.to_string e); + false + +let test_arms env = + Printf.printf "🔍 Testing Different Arms of Arvo\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 kernel = State.get_arvo state in + + Printf.printf "Trying arms 2 through 10...\n\n"; + + for arm = 2 to 10 do + let _ = test_arm arm kernel in + () + done; + + Printf.printf "\nNow trying specific formulas:\n\n"; + + (* Try the actual C Vere poke formula from u3v_poke *) + Printf.printf "C Vere style (simplified): "; + try + (* Subject is [now kernel] typically *) + let now = Noun.atom 0 in + let poke_subject = Noun.cell now kernel in + + (* Formula to replace sample and call *) + (* [8 kernel-with-new-sample [9 2 [0 1]]] *) + let formula = Noun.cell (Noun.atom 8) + (Noun.cell kernel + (Noun.cell (Noun.atom 9) + (Noun.cell (Noun.atom 2) + (Noun.cell (Noun.atom 0) (Noun.atom 1))))) in + + let _result = Nock.nock_on poke_subject formula in + Printf.printf "✓ Success!\n" + with e -> + Printf.printf "✗ %s\n" (Printexc.to_string e) + +let () = + Printf.printf "\n"; + Printf.printf "═══════════════════════════════════════════════════════════\n"; + Printf.printf " Testing Arms of Arvo Kernel\n"; + Printf.printf "═══════════════════════════════════════════════════════════\n"; + Printf.printf "\n"; + + Eio_main.run test_arms -- cgit v1.2.3