summaryrefslogtreecommitdiff
path: root/ocaml/test/test_slot3.ml
blob: 246cfc314b5378fb60346459f553853b8fbfead6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(* Test slot 3 extraction to compare with C *)

open Nock_lib

let () =
  Printf.printf "Loading ivory.pill...\n%!";
  Eio_main.run (fun env ->
    let fs = Eio.Stdenv.fs env in
    let pill_bytes = Eio.Path.(load (fs / "ivory.pill")) |> Bytes.of_string in

    Printf.printf "Cuing...\n%!";
    let pill = Serial.cue pill_bytes in
    let pill_mug = Noun.mug pill in
    Printf.printf "Pill mug: 0x%08lx\n%!" pill_mug;

    (* Extract core (tail of pill) *)
    let core = Noun.tail pill in
    let core_mug = Noun.mug core in
    Printf.printf "Core mug: 0x%08lx\n%!" core_mug;

    (* Extract slot 2 (head) *)
    let slot2 = Noun.slot (Z.of_int 2) core in
    let slot2_mug = Noun.mug slot2 in
    Printf.printf "Slot 2 (head) mug: 0x%08lx\n%!" slot2_mug;

    (* Extract slot 3 (tail) *)
    let slot3 = Noun.slot (Z.of_int 3) core in
    let slot3_mug = Noun.mug slot3 in
    Printf.printf "Slot 3 (tail) mug: 0x%08lx\n%!" slot3_mug;
  )