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_arvo.ml | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 ocaml/test/test_arvo.ml (limited to 'ocaml/test/test_arvo.ml') diff --git a/ocaml/test/test_arvo.ml b/ocaml/test/test_arvo.ml new file mode 100644 index 0000000..8325589 --- /dev/null +++ b/ocaml/test/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 -- cgit v1.2.3