diff options
Diffstat (limited to 'ocaml/test/old/jam_compare.ml')
-rw-r--r-- | ocaml/test/old/jam_compare.ml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/ocaml/test/old/jam_compare.ml b/ocaml/test/old/jam_compare.ml new file mode 100644 index 0000000..bdbc306 --- /dev/null +++ b/ocaml/test/old/jam_compare.ml @@ -0,0 +1,36 @@ +open Nock_lib.Noun +open Nock_lib.Serial + +let () = + Printf.printf "# OCaml jam outputs (hex)\n"; + + (* Simple atoms *) + Printf.printf "0: %s\n" (bytes_to_hex (jam (atom 0))); + Printf.printf "1: %s\n" (bytes_to_hex (jam (atom 1))); + Printf.printf "2: %s\n" (bytes_to_hex (jam (atom 2))); + Printf.printf "42: %s\n" (bytes_to_hex (jam (atom 42))); + Printf.printf "255: %s\n" (bytes_to_hex (jam (atom 255))); + Printf.printf "256: %s\n" (bytes_to_hex (jam (atom 256))); + + (* Simple cells *) + Printf.printf "[1 2]: %s\n" (bytes_to_hex (jam (cell (atom 1) (atom 2)))); + Printf.printf "[0 0]: %s\n" (bytes_to_hex (jam (cell (atom 0) (atom 0)))); + Printf.printf "[42 43]: %s\n" (bytes_to_hex (jam (cell (atom 42) (atom 43)))); + + (* Nested cells *) + Printf.printf "[[1 2] 3]: %s\n" + (bytes_to_hex (jam (cell (cell (atom 1) (atom 2)) (atom 3)))); + Printf.printf "[1 [2 3]]: %s\n" + (bytes_to_hex (jam (cell (atom 1) (cell (atom 2) (atom 3))))); + + (* Balanced tree *) + Printf.printf "[[1 2] [3 4]]: %s\n" + (bytes_to_hex (jam (cell (cell (atom 1) (atom 2)) (cell (atom 3) (atom 4))))); + + (* Larger tree *) + Printf.printf "[[[1 2] [3 4]] [[5 6] [7 8]]]: %s\n" + (bytes_to_hex (jam ( + cell + (cell (cell (atom 1) (atom 2)) (cell (atom 3) (atom 4))) + (cell (cell (atom 5) (atom 6)) (cell (atom 7) (atom 8))) + ))) |