diff options
author | polwex <polwex@sortug.com> | 2025-10-06 10:30:19 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-10-06 10:30:19 +0700 |
commit | 4be1d7f999ffb3eb1c12c54e863b141af21b3fbf (patch) | |
tree | 6e33b141cd98985799e02a253dddcf201fec6b74 /ocaml/test/test_arvo_slots.ml | |
parent | c3545b7ba9e8448226417fab6edaa2d039c9babe (diff) |
some progress but man
Diffstat (limited to 'ocaml/test/test_arvo_slots.ml')
-rw-r--r-- | ocaml/test/test_arvo_slots.ml | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/ocaml/test/test_arvo_slots.ml b/ocaml/test/test_arvo_slots.ml new file mode 100644 index 0000000..5ec9f76 --- /dev/null +++ b/ocaml/test/test_arvo_slots.ml @@ -0,0 +1,74 @@ +(* Test Available Slots on Arvo Core + * + * Check what slots are available on the Arvo core we found + *) + +open Nock_lib + +let test_slot slot arvo = + try + let value = Noun.slot (Z.of_int slot) arvo in + Printf.printf " Slot %2d: exists (%s)\n" slot + (if Noun.is_cell value then "cell" else "atom"); + Some value + with _ -> + Printf.printf " Slot %2d: does not exist\n" slot; + None + +let test_arvo_slots env = + Printf.printf "🔍 Testing Available Slots on Arvo Core\n\n"; + + Eio.Switch.run @@ fun _sw -> + let fs = Eio.Stdenv.fs env in + + (* Load solid pill *) + let state = State.create () in + match Boot.boot_from_file ~fs state "solid.pill" with + | Error msg -> + Printf.printf "✗ Failed to load pill: %s\n%!" msg + | Ok () -> + let pill_root = State.get_arvo state in + + Printf.printf "=== Testing PILL ROOT ===\n\n"; + Printf.printf "Testing slots 2-30 on pill root:\n\n"; + List.iter (fun slot -> ignore (test_slot slot pill_root)) + (List.init 29 (fun i -> i + 2)); + + Printf.printf "\n\n=== Testing ARVO CORE (at depth 8) ===\n\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 "Testing slots 2-30 on Arvo core:\n\n"; + List.iter (fun slot -> ignore (test_slot slot arvo)) + (List.init 29 (fun i -> i + 2)); + + Printf.printf "\nLooking for formula slots that might be poke...\n\n"; + + (* Check if any slot contains a formula (cell starting with opcode) *) + for slot = 2 to 30 do + match test_slot slot arvo with + | Some value when Noun.is_cell value -> + (match Noun.head value with + | Noun.Atom z when Z.numbits z < 8 -> + let opcode = Z.to_int z in + if opcode >= 0 && opcode <= 11 then + Printf.printf " Slot %d contains formula with opcode %d\n" slot opcode + | _ -> ()) + | _ -> () + done + +let () = + Printf.printf "\n"; + Printf.printf "═══════════════════════════════════════════════════════════\n"; + Printf.printf " Testing Arvo Core Slots\n"; + Printf.printf "═══════════════════════════════════════════════════════════\n"; + Printf.printf "\n"; + + Eio_main.run test_arvo_slots |