summaryrefslogtreecommitdiff
path: root/ocaml
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-06 22:16:33 +0700
committerpolwex <polwex@sortug.com>2025-10-06 22:16:33 +0700
commitda03400d5857aab4c809c34f0416d1c09c4fed12 (patch)
treee44d94e3ceeafc108e1290a1de2e5c9c12012d48 /ocaml
parent64b132efc5ad870677ac974334b30fdbc4afafd3 (diff)
pretty good pretty good
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/lib/nock.ml2
-rw-r--r--ocaml/test/test_two_stage_boot.ml37
2 files changed, 34 insertions, 5 deletions
diff --git a/ocaml/lib/nock.ml b/ocaml/lib/nock.ml
index 97a1d71..2f52922 100644
--- a/ocaml/lib/nock.ml
+++ b/ocaml/lib/nock.ml
@@ -28,7 +28,7 @@ open Noun
let call_count = ref 0
let depth = ref 0
let max_calls = 100
-let max_mug_depth = 3 (* Only log mugs for depth <= 3 to avoid performance hit *)
+let max_mug_depth = -1 (* Disabled: need mug caching like C before enabling *)
(* Helper to generate indentation based on depth *)
let indent () =
diff --git a/ocaml/test/test_two_stage_boot.ml b/ocaml/test/test_two_stage_boot.ml
index 7986b1d..da4f17b 100644
--- a/ocaml/test/test_two_stage_boot.ml
+++ b/ocaml/test/test_two_stage_boot.ml
@@ -57,15 +57,44 @@ let stage1_ivory_boot env =
Printf.printf " ✓ SUCCESS! Kernel built in %.4fs\n\n" elapsed;
(* Verify kernel has poke at slot 23 *)
- Printf.printf "[5] Verifying kernel structure...\n%!";
+ Printf.printf "[6] Verifying kernel structure...\n%!";
begin try
- let _poke = Noun.slot (Z.of_int 23) kernel in
- Printf.printf " ✓ Has poke gate at slot 23\n\n";
-
+ let poke = Noun.slot (Z.of_int 23) kernel in
+ Printf.printf " ✓ Has poke gate at slot 23\n";
+
+ (* Check structure at known slots to verify correctness *)
+ Printf.printf " Checking structural properties:\n";
+
+ (* Slot 2: should be battery (cell) *)
+ let slot2 = Noun.slot (Z.of_int 2) kernel in
+ Printf.printf " Slot 2 (battery): %s\n"
+ (if Noun.is_cell slot2 then "cell ✓" else "atom ✗");
+
+ (* Slot 3: should be payload (cell) *)
+ let slot3 = Noun.slot (Z.of_int 3) kernel in
+ Printf.printf " Slot 3 (payload): %s\n"
+ (if Noun.is_cell slot3 then "cell ✓" else "atom ✗");
+
+ (* Poke should be a cell (it's a gate) *)
+ Printf.printf " Slot 23 (poke): %s\n"
+ (if Noun.is_cell poke then "cell (gate) ✓" else "atom ✗");
+
+ (* Check head of poke (should be battery) *)
+ if Noun.is_cell poke then begin
+ let poke_battery = Noun.head poke in
+ Printf.printf " Poke battery: %s\n"
+ (if Noun.is_cell poke_battery then "cell ✓" else "atom ✗")
+ end;
+
+ Printf.printf "\n";
Printf.printf "╔═══════════════════════════════════════╗\n";
Printf.printf "║ ✓ STAGE 1 COMPLETE! ║\n";
Printf.printf "╚═══════════════════════════════════════╝\n\n";
+ Printf.printf "⚠️ NOTE: Structural checks passed, but cannot verify\n";
+ Printf.printf " kernels are identical without mug comparison.\n";
+ Printf.printf " Need to implement mug caching first!\n\n";
+
Some kernel
with _ ->