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/old/test_arvo.ml | |
parent | fdab65f6dac4ba85ed4749f61970660d1132d453 (diff) |
cleaned up tests
Diffstat (limited to 'ocaml/test/old/test_arvo.ml')
-rw-r--r-- | ocaml/test/old/test_arvo.ml | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/ocaml/test/old/test_arvo.ml b/ocaml/test/old/test_arvo.ml new file mode 100644 index 0000000..8325589 --- /dev/null +++ b/ocaml/test/old/test_arvo.ml @@ -0,0 +1,69 @@ +(* Test Real Arvo Execution + * + * Load ivory pill and try to poke Arvo with a test event + *) + +open Nock_lib + +let test_load_and_poke env = + Printf.printf "๐งช Testing Real Arvo Execution\n\n"; + + Eio.Switch.run @@ fun _sw -> + let fs = Eio.Stdenv.fs env in + + (* Load ivory pill *) + Printf.printf "Loading ivory pill...\n%!"; + 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; + failwith "Pill load failed" + + | Ok () -> + Printf.printf "โ Ivory kernel loaded!\n\n"; + + (* Create a simple test event (ovum) *) + Printf.printf "Creating test event...\n%!"; + let test_event = Noun.cell + (Noun.atom 0) (* wire: simple routing *) + (Noun.cell + (Noun.atom 1) (* vane tag *) + (Noun.atom 42)) (* simple data *) + in + + Printf.printf "Test event: [wire card]\n%!"; + Printf.printf " wire: 0\n%!"; + Printf.printf " card: [1 42]\n\n%!"; + + (* Try to poke Arvo! *) + Printf.printf "๐ Poking Arvo with test event...\n%!"; + + try + let start = Unix.gettimeofday () in + let effects = State.poke state test_event in + let elapsed = Unix.gettimeofday () -. start in + + Printf.printf "โ Poke succeeded in %.4f seconds!\n\n" elapsed; + + Printf.printf "Effects returned: %d\n%!" (List.length effects); + Printf.printf "New event number: %Ld\n\n%!" (State.event_num state); + + Printf.printf "๐ ARVO IS RUNNING!\n%!"; + + with e -> + Printf.printf "โ Poke failed with exception:\n%!"; + Printf.printf " %s\n\n%!" (Printexc.to_string e); + Printf.printf "This is expected - we need to figure out:\n%!"; + Printf.printf " 1. Correct event format\n%!"; + Printf.printf " 2. Correct poke formula\n%!"; + Printf.printf " 3. How to parse results\n%!" + +let () = + Printf.printf "\n"; + Printf.printf "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n"; + Printf.printf " Testing Real Arvo Execution with Ivory Pill\n"; + Printf.printf "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n"; + Printf.printf "\n"; + + Eio_main.run test_load_and_poke |