summaryrefslogtreecommitdiff
path: root/ocaml/test/test_functional_bios.ml
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-06 23:18:59 +0700
committerpolwex <polwex@sortug.com>2025-10-06 23:18:59 +0700
commit5de3f7a3ad7b0cf63b4a6cbddfc1e26359dea161 (patch)
treeb55b2258123149bed40bd89bbaa58e7da54f3a26 /ocaml/test/test_functional_bios.ml
parentfdab65f6dac4ba85ed4749f61970660d1132d453 (diff)
cleaned up tests
Diffstat (limited to 'ocaml/test/test_functional_bios.ml')
-rw-r--r--ocaml/test/test_functional_bios.ml132
1 files changed, 0 insertions, 132 deletions
diff --git a/ocaml/test/test_functional_bios.ml b/ocaml/test/test_functional_bios.ml
deleted file mode 100644
index 5679c3f..0000000
--- a/ocaml/test/test_functional_bios.ml
+++ /dev/null
@@ -1,132 +0,0 @@
-(* Test the functional BIOS formula [2 [0 3] [0 2]] on event list *)
-
-open Nock_lib
-
-let test_bios _env =
- Printf.printf "šŸš€ Testing Functional BIOS Formula\n\n";
-
- (* Load solid pill *)
- Printf.printf "Loading solid pill...\n";
- let in_channel = open_in_bin "solid.noun" in
- let pill = (Marshal.from_channel in_channel : Noun.noun) in
- close_in in_channel;
-
- match pill with
- | Noun.Cell (_tag, events) ->
- Printf.printf "Found events\n\n";
-
- (* Build the functional BIOS formula: [2 [0 3] [0 2]] *)
- Printf.printf "Building functional BIOS formula: [2 [0 3] [0 2]]\n";
- let bios_formula = Noun.cell
- (Noun.atom 2)
- (Noun.cell
- (Noun.cell (Noun.atom 0) (Noun.atom 3))
- (Noun.cell (Noun.atom 0) (Noun.atom 2)))
- in
- Printf.printf "Formula: %s\n\n"
- (match bios_formula with Noun.Cell _ -> "built" | _ -> "error");
-
- (* Run the formula on the event list! *)
- Printf.printf "Running formula on entire event list...\n";
- Printf.printf "(This processes ALL 5 events at once!)\n\n";
-
- let start = Unix.gettimeofday () in
-
- begin try
- let result = Nock.nock_on events bios_formula in
- let elapsed = Unix.gettimeofday () -. start in
-
- Printf.printf "āœ“ Formula succeeded in %.4fs!\n\n" elapsed;
-
- (* Extract slot 7 from result *)
- Printf.printf "Extracting slot 7 from result...\n";
- begin try
- let kernel = Noun.slot (Z.of_int 7) result in
- Printf.printf "āœ“ Got kernel at slot 7!\n\n";
-
- (* Check what slots this kernel has *)
- Printf.printf "Checking kernel slots:\n";
-
- begin try
- let _poke23 = Noun.slot (Z.of_int 23) kernel in
- Printf.printf " āœ“ Has slot 23 (larval poke)\n"
- with _ ->
- Printf.printf " āœ— No slot 23\n"
- end;
-
- begin try
- let _poke42 = Noun.slot (Z.of_int 42) kernel in
- Printf.printf " āœ“ Has slot 42 (adult poke)\n"
- with _ ->
- Printf.printf " āœ— No slot 42\n"
- end;
-
- Printf.printf "\nšŸŽ‰ FUNCTIONAL BIOS BOOT COMPLETE!\n\n";
-
- (* Try a test poke on slot 42 *)
- Printf.printf "Testing poke on slot 42...\n";
-
- begin try
- let poke_gate = Noun.slot (Z.of_int 42) kernel in
-
- (* Build test event *)
- let wire = Noun.atom 0 in
- let card = Noun.cell (Noun.atom 1953719668) (Noun.atom 42) in
- let ovum = Noun.cell wire card in
- let now = Noun.atom 0 in
- let poke_arg = Noun.cell now ovum in
-
- (* Slam *)
- let battery = Noun.head poke_gate in
- let context = Noun.tail (Noun.tail poke_gate) in
- let new_core = Noun.cell battery (Noun.cell poke_arg context) in
- let kick_formula = Noun.cell (Noun.atom 9)
- (Noun.cell (Noun.atom 2)
- (Noun.cell (Noun.atom 0) (Noun.atom 1))) in
-
- let poke_result = Nock.nock_on new_core kick_formula in
-
- begin match poke_result with
- | Noun.Cell (_effects, _new_kernel) ->
- Printf.printf " šŸŽŠ SLOT 42 POKE WORKS!\n\n";
- Printf.printf "═══════════════════════════════════════════\n";
- Printf.printf " ARVO IS FULLY BOOTED AND OPERATIONAL!\n";
- Printf.printf "═══════════════════════════════════════════\n\n";
- Printf.printf "This means we can now:\n";
- Printf.printf " āœ… Run the functional BIOS formula\n";
- Printf.printf " āœ… Extract the booted kernel\n";
- Printf.printf " āœ… Poke events into Arvo\n";
- Printf.printf " āœ… Build a complete Urbit runtime!\n"
- | Noun.Atom _ ->
- Printf.printf " Result is atom\n"
- end
-
- with
- | Noun.Exit ->
- Printf.printf " āœ— Poke failed (Nock Exit)\n"
- | e ->
- Printf.printf " āœ— Error: %s\n" (Printexc.to_string e)
- end
-
- with
- | Not_found ->
- Printf.printf "āœ— No slot 7 in result\n"
- | e ->
- Printf.printf "āœ— Error accessing slot 7: %s\n" (Printexc.to_string e)
- end
-
- with
- | Noun.Exit ->
- Printf.printf "āœ— Formula failed (Nock Exit)\n"
- | e ->
- Printf.printf "āœ— Error: %s\n" (Printexc.to_string e)
- end
-
- | Noun.Atom _ ->
- Printf.printf "āœ— Pill is atom\n"
-
-let () =
- Printf.printf "\n═══════════════════════════════════════════\n";
- Printf.printf " Test Functional BIOS Formula\n";
- Printf.printf "═══════════════════════════════════════════\n\n";
- Eio_main.run test_bios