summaryrefslogtreecommitdiff
path: root/ocaml/test
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-06 22:06:53 +0700
committerpolwex <polwex@sortug.com>2025-10-06 22:06:53 +0700
commit64b132efc5ad870677ac974334b30fdbc4afafd3 (patch)
tree6f3d07fd9ff08d0cfc854d0396fa03c2e3d2622b /ocaml/test
parent6ce2c5919f36776fe8aea711b94bbd2d64c8207a (diff)
kinda getting there
Diffstat (limited to 'ocaml/test')
-rw-r--r--ocaml/test/test_two_stage_boot.ml249
1 files changed, 125 insertions, 124 deletions
diff --git a/ocaml/test/test_two_stage_boot.ml b/ocaml/test/test_two_stage_boot.ml
index f8311b5..7986b1d 100644
--- a/ocaml/test/test_two_stage_boot.ml
+++ b/ocaml/test/test_two_stage_boot.ml
@@ -87,150 +87,151 @@ let stage1_ivory_boot env =
None
(* Stage 2: Boot solid pill events *)
-let stage2_solid_boot env _ivory_kernel =
- Printf.printf "\n╔═══════════════════════════════════════╗\n";
- Printf.printf "║ STAGE 2: Solid Pill Events ║\n";
- Printf.printf "╚═══════════════════════════════════════╝\n\n";
+(* let stage2_solid_boot env _ivory_kernel = *)
+ (* Printf.printf "\n╔═══════════════════════════════════════╗\n"; *)
+ (* Printf.printf "║ STAGE 2: Solid Pill Events ║\n"; *)
+ (* Printf.printf "╚═══════════════════════════════════════╝\n\n"; *)
(* Load solid pill *)
- Printf.printf "[1] Loading solid.pill...\n%!";
- let fs = Eio.Stdenv.fs env in
- let pill_bytes = Eio.Path.(load (fs / "solid.pill")) |> Bytes.of_string in
- Printf.printf " Size: %d bytes (%.1f MB)\n%!"
- (Bytes.length pill_bytes)
- (float_of_int (Bytes.length pill_bytes) /. 1024.0 /. 1024.0);
-
- Printf.printf "[2] Cuing solid pill...\n%!";
- let start = Unix.gettimeofday () in
- let pill = Serial.cue pill_bytes in
- let elapsed = Unix.gettimeofday () -. start in
- Printf.printf " ✓ Cued in %.2fs\n\n%!" elapsed;
+ (* Printf.printf "[1] Loading solid.pill...\n%!"; *)
+ (* let fs = Eio.Stdenv.fs env in *)
+ (* let pill_bytes = Eio.Path.(load (fs / "solid.pill")) |> Bytes.of_string in *)
+ (* Printf.printf " Size: %d bytes (%.1f MB)\n%!" *)
+ (* (Bytes.length pill_bytes) *)
+ (* (float_of_int (Bytes.length pill_bytes) /. 1024.0 /. 1024.0); *)
+
+ (* Printf.printf "[2] Cuing solid pill...\n%!"; *)
+ (* let start = Unix.gettimeofday () in *)
+ (* let pill = Serial.cue pill_bytes in *)
+ (* let elapsed = Unix.gettimeofday () -. start in *)
+ (* Printf.printf " ✓ Cued in %.2fs\n\n%!" elapsed; *)
(* Parse structure: [%pill %solid [bot mod use]] *)
- Printf.printf "[3] Parsing solid pill structure...\n%!";
- match pill with
- | Noun.Cell (_tag, rest) ->
- begin match rest with
- | Noun.Cell (_typ, rest2) ->
- Printf.printf " Tag: pill\n";
- Printf.printf " Type: solid\n";
-
- begin match rest2 with
- | Noun.Cell (bot, rest3) ->
+ (* Printf.printf "[3] Parsing solid pill structure...\n%!"; *)
+ (* match pill with *)
+ (* | Noun.Cell (_tag, rest) -> *)
+ (* begin match rest with *)
+ (* | Noun.Cell (_typ, rest2) -> *)
+ (* Printf.printf " Tag: pill\n"; *)
+ (* Printf.printf " Type: solid\n"; *)
+
+ (* begin match rest2 with *)
+ (* | Noun.Cell (bot, rest3) -> *)
(* Count bot events *)
- let rec count_list acc n =
- match n with
- | Noun.Atom _ -> acc
- | Noun.Cell (_, rest) -> count_list (acc + 1) rest
- in
- let bot_count = count_list 0 bot in
- Printf.printf " Bot events: %d\n" bot_count;
-
- begin match rest3 with
- | Noun.Cell (mod_, rest4) ->
- let mod_count = count_list 0 mod_ in
- Printf.printf " Mod events: %d\n" mod_count;
-
- begin match rest4 with
- | Noun.Cell (use, _) ->
- let use_count = count_list 0 use in
- Printf.printf " Use events: %d\n" use_count;
-
- let total = bot_count + mod_count + use_count in
- Printf.printf " Total: %d events\n\n" total;
+ (* let rec count_list acc n = *)
+ (* match n with *)
+ (* | Noun.Atom _ -> acc *)
+ (* | Noun.Cell (_, rest) -> count_list (acc + 1) rest *)
+ (* in *)
+ (* let bot_count = count_list 0 bot in *)
+ (* Printf.printf " Bot events: %d\n" bot_count; *)
+
+ (* begin match rest3 with *)
+ (* | Noun.Cell (mod_, rest4) -> *)
+ (* let mod_count = count_list 0 mod_ in *)
+ (* Printf.printf " Mod events: %d\n" mod_count; *)
+
+ (* begin match rest4 with *)
+ (* | Noun.Cell (use, _) -> *)
+ (* let use_count = count_list 0 use in *)
+ (* Printf.printf " Use events: %d\n" use_count; *)
+
+ (* let total = bot_count + mod_count + use_count in *)
+ (* Printf.printf " Total: %d events\n\n" total; *)
(* Concatenate all events into a single list *)
- Printf.printf "[4] Concatenating all events...\n%!";
- let rec append_lists l1 l2 =
- match l1 with
- | Noun.Atom _ -> l2
- | Noun.Cell (h, t) -> Noun.cell h (append_lists t l2)
- in
- let all_events = append_lists bot (append_lists mod_ use) in
- Printf.printf " ✓ Event list built\n\n";
+ (* Printf.printf "[4] Concatenating all events...\n%!"; *)
+ (* let rec append_lists l1 l2 = *)
+ (* match l1 with *)
+ (* | Noun.Atom _ -> l2 *)
+ (* | Noun.Cell (h, t) -> Noun.cell h (append_lists t l2) *)
+ (* in *)
+ (* let all_events = append_lists bot (append_lists mod_ use) in *)
+ (* Printf.printf " ✓ Event list built\n\n"; *)
(* Now run u3v_boot on all events *)
- Printf.printf "[5] Running u3v_boot() on %d events...\n%!" total;
- Printf.printf " This will call u3v_life() with the event list\n%!";
+ (* Printf.printf "[5] Running u3v_boot() on %d events...\n%!" total; *)
+ (* Printf.printf " This will call u3v_life() with the event list\n%!"; *)
- begin try
- let start = Unix.gettimeofday () in
+ (* begin try *)
+ (* let start = Unix.gettimeofday () in *)
(* Call the lifecycle formula on the event list *)
- Printf.printf " Running [2 [0 3] [0 2]] on event list...\n%!";
- let kernel = Boot.life all_events in
+ (* Printf.printf " Running [2 [0 3] [0 2]] on event list...\n%!"; *)
+ (* let kernel = Boot.life all_events in *)
- let elapsed = Unix.gettimeofday () -. start in
- Printf.printf " ✓ SUCCESS! Kernel updated in %.4fs\n\n" elapsed;
+ (* let elapsed = Unix.gettimeofday () -. start in *)
+ (* Printf.printf " ✓ SUCCESS! Kernel updated in %.4fs\n\n" elapsed; *)
(* Verify kernel *)
- Printf.printf "[6] Verifying updated kernel...\n%!";
- begin try
- let _poke = Noun.slot (Z.of_int 23) kernel in
- Printf.printf " ✓ Has poke gate at slot 23\n\n";
-
- Printf.printf "╔═══════════════════════════════════════╗\n";
- Printf.printf "║ 🎉🎉🎉 FULL BOOT SUCCESS! 🎉🎉🎉 ║\n";
- Printf.printf "╚═══════════════════════════════════════╝\n\n";
-
- Printf.printf "Boot sequence complete:\n";
- Printf.printf " 1. Stage 1: Ivory pill with null → Initial kernel\n";
- Printf.printf " 2. Stage 2: Solid pill %d events → Updated kernel\n" total;
- Printf.printf " 3. Kernel is ready to receive pokes!\n\n";
-
- true
-
- with _ ->
- Printf.printf " ✗ No slot 23 in updated kernel\n\n";
- false
- end
-
- with
- | Noun.Exit ->
- Printf.printf " ✗ FAILED: Nock Exit during lifecycle\n\n";
- false
-
- | e ->
- Printf.printf " ✗ FAILED: %s\n\n" (Printexc.to_string e);
- false
- end
-
- | Noun.Atom _ ->
- Printf.printf " ✗ rest4 is atom (expected use)\n";
- false
- end
-
- | Noun.Atom _ ->
- Printf.printf " ✗ rest3 is atom (expected [mod use])\n";
- false
- end
-
- | Noun.Atom _ ->
- Printf.printf " ✗ rest2 is atom (expected [bot mod use])\n";
- false
- end
-
- | Noun.Atom _ ->
- Printf.printf " ✗ rest is atom (expected [type ...])\n";
- false
- end
-
- | Noun.Atom _ ->
- Printf.printf " ✗ Pill is atom (expected cell)\n";
- false
+ (* Printf.printf "[6] Verifying updated kernel...\n%!"; *)
+ (* begin try *)
+ (* let _poke = Noun.slot (Z.of_int 23) kernel in *)
+ (* Printf.printf " ✓ Has poke gate at slot 23\n\n"; *)
+
+ (* Printf.printf "╔═══════════════════════════════════════╗\n"; *)
+ (* Printf.printf "║ 🎉🎉🎉 FULL BOOT SUCCESS! 🎉🎉🎉 ║\n"; *)
+ (* Printf.printf "╚═══════════════════════════════════════╝\n\n"; *)
+
+ (* Printf.printf "Boot sequence complete:\n"; *)
+ (* Printf.printf " 1. Stage 1: Ivory pill with null → Initial kernel\n"; *)
+ (* Printf.printf " 2. Stage 2: Solid pill %d events → Updated kernel\n" total; *)
+ (* Printf.printf " 3. Kernel is ready to receive pokes!\n\n"; *)
+
+ (* true *)
+
+ (* with _ -> *)
+ (* Printf.printf " ✗ No slot 23 in updated kernel\n\n"; *)
+ (* false *)
+ (* end *)
+
+ (* with *)
+ (* | Noun.Exit -> *)
+ (* Printf.printf " ✗ FAILED: Nock Exit during lifecycle\n\n"; *)
+ (* false *)
+
+ (* | e -> *)
+ (* Printf.printf " ✗ FAILED: %s\n\n" (Printexc.to_string e); *)
+ (* false *)
+ (* end *)
+
+ (* | Noun.Atom _ -> *)
+ (* Printf.printf " ✗ rest4 is atom (expected use)\n"; *)
+ (* false *)
+ (* end *)
+
+ (* | Noun.Atom _ -> *)
+ (* Printf.printf " ✗ rest3 is atom (expected [mod use])\n"; *)
+ (* false *)
+ (* end *)
+
+ (* | Noun.Atom _ -> *)
+ (* Printf.printf " ✗ rest2 is atom (expected [bot mod use])\n"; *)
+ (* false *)
+ (* end *)
+
+ (* | Noun.Atom _ -> *)
+ (* Printf.printf " ✗ rest is atom (expected [type ...])\n"; *)
+ (* false *)
+ (* end *)
+
+ (* | Noun.Atom _ -> *)
+ (* Printf.printf " ✗ Pill is atom (expected cell)\n"; *)
+ (* false *)
(* Main test *)
let main env =
(* Stage 1: Ivory *)
- match stage1_ivory_boot env with
- | Some ivory_kernel ->
+ let _success = stage1_ivory_boot env in ()
+ (* match stage1_ivory_boot env with *)
+ (* | Some ivory_kernel -> *)
(* Stage 2: Solid *)
- let _success = stage2_solid_boot env ivory_kernel in
- ()
+ (* let _success = stage2_solid_boot env ivory_kernel in *)
+ (* () *)
- | None ->
- Printf.printf "╔═══════════════════════════════════════╗\n";
- Printf.printf "║ ✗ STAGE 1 FAILED - Cannot continue ║\n";
- Printf.printf "╚═══════════════════════════════════════╝\n\n"
+ (* | None -> *)
+ (* Printf.printf "╔═══════════════════════════════════════╗\n"; *)
+ (* Printf.printf "║ ✗ STAGE 1 FAILED - Cannot continue ║\n"; *)
+ (* Printf.printf "╚═══════════════════════════════════════╝\n\n" *)
let () = Eio_main.run main