summaryrefslogtreecommitdiff
path: root/ocaml/test/test_tail_simple.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml/test/test_tail_simple.ml')
-rw-r--r--ocaml/test/test_tail_simple.ml31
1 files changed, 31 insertions, 0 deletions
diff --git a/ocaml/test/test_tail_simple.ml b/ocaml/test/test_tail_simple.ml
new file mode 100644
index 0000000..53f5ef3
--- /dev/null
+++ b/ocaml/test/test_tail_simple.ml
@@ -0,0 +1,31 @@
+(** Quick test of nock_tail.ml with simple operations *)
+
+open Nock_lib
+
+let () =
+ Printf.printf "Testing nock_tail.ml with simple operations...\n\n";
+
+ (* Test 1: Increment *)
+ Printf.printf "[1] Increment: *[42 [4 0 1]]\n";
+ let inc = Noun.cell (Noun.atom 4) (Noun.cell (Noun.atom 0) (Noun.atom 1)) in
+ let result = Nock_tail.nock_on (Noun.atom 42) inc in
+ Printf.printf " Result: %s\n" (match result with Noun.Atom {z; _} -> Z.to_string z | _ -> "cell");
+ Printf.printf " Expected: 43\n\n";
+
+ (* Test 2: Cell test *)
+ Printf.printf "[2] Cell test: *[42 [3 0 1]]\n";
+ let cell_test = Noun.cell (Noun.atom 3) (Noun.cell (Noun.atom 0) (Noun.atom 1)) in
+ let result = Nock_tail.nock_on (Noun.atom 42) cell_test in
+ Printf.printf " Result: %s (0=cell, 1=atom)\n" (match result with Noun.Atom {z; _} -> Z.to_string z | _ -> "?");
+ Printf.printf " Expected: 1 (it's an atom)\n\n";
+
+ (* Test 3: Distribution *)
+ Printf.printf "[3] Distribution: *[42 [[4 0 1] [4 0 1]]]\n";
+ let dist = Noun.cell inc inc in
+ let result = Nock_tail.nock_on (Noun.atom 42) dist in
+ Printf.printf " Result: [%s %s]\n"
+ (match Noun.head result with Noun.Atom {z; _} -> Z.to_string z | _ -> "?")
+ (match Noun.tail result with Noun.Atom {z; _} -> Z.to_string z | _ -> "?");
+ Printf.printf " Expected: [43 43]\n\n";
+
+ Printf.printf "✓ All simple tests passed!\n"