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/inspect_events_simple.ml | |
parent | fdab65f6dac4ba85ed4749f61970660d1132d453 (diff) |
cleaned up tests
Diffstat (limited to 'ocaml/test/inspect_events_simple.ml')
-rw-r--r-- | ocaml/test/inspect_events_simple.ml | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/ocaml/test/inspect_events_simple.ml b/ocaml/test/inspect_events_simple.ml deleted file mode 100644 index 0cb05c9..0000000 --- a/ocaml/test/inspect_events_simple.ml +++ /dev/null @@ -1,88 +0,0 @@ -(* Simple event structure inspector *) - -open Nock_lib - -let describe_noun noun = - match noun with - | Noun.Atom a -> - if Z.numbits a <= 32 then - Printf.sprintf "Atom(%s)" (Z.to_string a) - else - Printf.sprintf "Atom(large, %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 inspect_events _env = - 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 "Tag: %s\n\n" (describe_noun tag); - - let event_list = to_list [] events in - Printf.printf "Found %d events\n\n" (List.length event_list); - - List.iteri (fun i event -> - Printf.printf "Event %d: " i; - match event with - | Noun.Atom a -> - Printf.printf "Atom(%s)\n" (Z.to_string a) - | Noun.Cell (head, tail) -> - Printf.printf "Cell[%s, %s]\n" - (describe_noun head) (describe_noun tail) - ) event_list; - - (* Look more closely at events 3 and 4 *) - Printf.printf "\n=== Detailed look at events 3 and 4 ===\n\n"; - - begin match List.nth_opt event_list 3 with - | Some (Noun.Cell (wire, card)) -> - Printf.printf "Event 3:\n"; - Printf.printf " wire: %s\n" (describe_noun wire); - Printf.printf " card: "; - begin match card with - | Noun.Cell (term, data) -> - Printf.printf "Cell[%s, %s]\n" - (describe_noun term) (describe_noun data) - | Noun.Atom _ -> - Printf.printf "%s\n" (describe_noun card) - end - | Some (Noun.Atom _) -> - Printf.printf "Event 3 is an atom\n" - | None -> - Printf.printf "No event 3\n" - end; - - begin match List.nth_opt event_list 4 with - | Some (Noun.Cell (wire, card)) -> - Printf.printf "\nEvent 4:\n"; - Printf.printf " wire: %s\n" (describe_noun wire); - Printf.printf " card: "; - begin match card with - | Noun.Cell (term, data) -> - Printf.printf "Cell[%s, %s]\n" - (describe_noun term) (describe_noun data) - | Noun.Atom _ -> - Printf.printf "%s\n" (describe_noun card) - end - | Some (Noun.Atom _) -> - Printf.printf "Event 4 is an atom\n" - | None -> - Printf.printf "No event 4\n" - end - - | Noun.Atom _ -> - Printf.printf "✗ Pill is an atom\n" - -let () = - Printf.printf "\n═══════════════════════════════════════════\n"; - Printf.printf " Simple Event Structure Inspector\n"; - Printf.printf "═══════════════════════════════════════════\n\n"; - Eio_main.run inspect_events |