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/examine_pill_events.ml | |
parent | fdab65f6dac4ba85ed4749f61970660d1132d453 (diff) |
cleaned up tests
Diffstat (limited to 'ocaml/test/examine_pill_events.ml')
-rw-r--r-- | ocaml/test/examine_pill_events.ml | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/ocaml/test/examine_pill_events.ml b/ocaml/test/examine_pill_events.ml deleted file mode 100644 index 8a11117..0000000 --- a/ocaml/test/examine_pill_events.ml +++ /dev/null @@ -1,88 +0,0 @@ -(* Examine what the bot/mod/use events actually contain *) - -open Nock_lib - -let describe_noun noun = - match noun with - | Noun.Atom a -> - if Z.numbits a <= 64 then - Printf.sprintf "Atom(%s)" (Z.to_string a) - else - Printf.sprintf "Atom(%d bits)" (Z.numbits a) - | Noun.Cell _ -> "Cell" - -let rec to_list acc noun = - match noun with - | Noun.Atom _ -> List.rev acc - | Noun.Cell (item, rest) -> to_list (item :: acc) rest - -let examine _env = - Printf.printf "Loading solid.noun...\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 "\n=== solid.noun structure ===\n\n"; - - let event_list = to_list [] events in - Printf.printf "Total: %d items in list\n\n" (List.length event_list); - - List.iteri (fun i event -> - Printf.printf "Item %d: %s\n" i (describe_noun event) - ) event_list; - - (* Check if this matches what u3v_life expects *) - Printf.printf "\n=== Testing u3v_life on this list ===\n\n"; - - (* Functional BIOS formula: [2 [0 3] [0 2]] *) - let lyf = 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 "Running [2 [0 3] [0 2]] on events...\n%!"; - - begin try - (* What does [0 2] get from events? *) - let slot2 = Noun.slot (Z.of_int 2) events in - Printf.printf " Slot 2 of events: %s\n" (describe_noun slot2); - - (* What does [0 3] get from events? *) - let slot3 = Noun.slot (Z.of_int 3) events in - Printf.printf " Slot 3 of events: %s\n\n" (describe_noun slot3); - - let start = Unix.gettimeofday () in - let gat = Nock.nock_on events lyf in - let elapsed = Unix.gettimeofday () -. start in - - Printf.printf "ā Formula succeeded in %.4fs!\n\n" elapsed; - - (* Extract slot 7 *) - let kernel = Noun.slot (Z.of_int 7) gat in - Printf.printf "ā Extracted kernel from slot 7\n\n"; - - (* Check if kernel has slot 23 *) - begin try - let _poke = Noun.slot (Z.of_int 23) kernel in - Printf.printf "ā Kernel has poke at slot 23\n"; - Printf.printf "\nš This is the correct event list format!\n" - with _ -> - Printf.printf "ā No slot 23\n" - end - - with - | Not_found -> - Printf.printf "ā Slot not found\n" - | Noun.Exit -> - Printf.printf "ā Nock Exit\n" - | e -> - Printf.printf "ā Error: %s\n" (Printexc.to_string e) - end - - | Noun.Atom _ -> - Printf.printf "Pill is atom\n" - -let () = - Eio_main.run examine |