summaryrefslogtreecommitdiff
path: root/ocaml/test/test_event4_slot42.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_event4_slot42.ml
parentfdab65f6dac4ba85ed4749f61970660d1132d453 (diff)
cleaned up tests
Diffstat (limited to 'ocaml/test/test_event4_slot42.ml')
-rw-r--r--ocaml/test/test_event4_slot42.ml104
1 files changed, 0 insertions, 104 deletions
diff --git a/ocaml/test/test_event4_slot42.ml b/ocaml/test/test_event4_slot42.ml
deleted file mode 100644
index ce98863..0000000
--- a/ocaml/test/test_event4_slot42.ml
+++ /dev/null
@@ -1,104 +0,0 @@
-(* Test Event 4 using slot 42 instead of slot 23 *)
-
-open Nock_lib
-
-let slam_on gate event =
- let battery = Noun.head gate in
- let context = Noun.tail (Noun.tail gate) in
- let new_core = Noun.cell battery (Noun.cell event context) in
- let kick_formula = Noun.cell (Noun.atom 9)
- (Noun.cell (Noun.atom 2)
- (Noun.cell (Noun.atom 0) (Noun.atom 1))) in
- Nock.nock_on new_core kick_formula
-
-let rec to_list acc noun =
- match noun with
- | Noun.Atom _ -> List.rev acc
- | Noun.Cell (item, rest) -> to_list (item :: acc) rest
-
-let test _env =
- Printf.printf "šŸš€ Testing Event 4 with Slot 42\n\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) ->
- let event_list = to_list [] events in
-
- let kernel1 = List.nth event_list 1 in
- let event3 = List.nth event_list 3 in
- let event4 = List.nth event_list 4 in
-
- (* Slam Event 3 with slot 23 *)
- Printf.printf "=== Event 3 (slot 23) ===\n";
- let poke_gate3 = Noun.slot (Z.of_int 23) kernel1 in
- let result3 = slam_on poke_gate3 (Noun.cell (Noun.atom 0) event3) in
-
- let kernel_after_3 = match result3 with
- | Noun.Cell (_effects, new_kernel) ->
- Printf.printf "āœ“ Succeeded\n\n";
- new_kernel
- | _ -> kernel1
- in
-
- (* Try Event 4 with SLOT 42 *)
- Printf.printf "=== Event 4 (slot 42) ===\n";
- begin try
- let poke_gate4 = Noun.slot (Z.of_int 42) kernel_after_3 in
- Printf.printf "āœ“ Found poke gate at slot 42\n";
-
- (* Check gate structure *)
- begin match poke_gate4 with
- | Noun.Cell (battery, payload) ->
- Printf.printf " Battery: %s\n" (match battery with Noun.Atom _ -> "atom" | Noun.Cell _ -> "cell");
- begin match payload with
- | Noun.Cell (_sample, _context) ->
- Printf.printf " Payload: cell [sample context] āœ“\n\n"
- | _ ->
- Printf.printf " Payload: atom āœ—\n\n"
- end
- | _ -> ()
- end;
-
- Printf.printf "Slamming Event 4...\n";
- let start = Unix.gettimeofday () in
- let result4 = slam_on poke_gate4 (Noun.cell (Noun.atom 0) event4) in
- let elapsed = Unix.gettimeofday () -. start in
-
- begin match result4 with
- | Noun.Cell (_effects, _new_kernel) ->
- Printf.printf "āœ“ Event 4 succeeded in %.4fs!\n\n" elapsed;
- Printf.printf "═══════════════════════════════════════════\n";
- Printf.printf " šŸŽ‰šŸŽ‰šŸŽ‰ FULL BOOT SUCCESS! šŸŽ‰šŸŽ‰šŸŽ‰\n";
- Printf.printf "═══════════════════════════════════════════\n\n";
- Printf.printf "Boot sequence:\n";
- Printf.printf " 1. Event 1: Initial larval kernel\n";
- Printf.printf " 2. Event 3: Poked with slot 23 (larval)\n";
- Printf.printf " 3. Kernel metamorphosed!\n";
- Printf.printf " 4. Event 4: Poked with slot 42 (adult)\n\n";
- Printf.printf "The kernel has metamorphosed from larval to adult!\n";
- Printf.printf " - Larval poke: slot 23\n";
- Printf.printf " - Adult poke: slot 42\n"
- | Noun.Atom _ ->
- Printf.printf "Result is atom\n"
- end
-
- with
- | Noun.Exit ->
- Printf.printf "āœ— Still failed with slot 42\n"
- | Not_found ->
- Printf.printf "āœ— No slot 42 found\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 Event 4 with Slot 42\n";
- Printf.printf "═══════════════════════════════════════════\n\n";
- Eio_main.run test