summaryrefslogtreecommitdiff
path: root/ocaml/test_cue_solid.ml
blob: 95be2da3afcd1083a84d4196b2553269e35fc279 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
open Nock_lib

let () =
  let bytes = Eio.Path.(load (Eio.Stdenv.fs (Eio_main.run (fun env -> env)) / "solid.pill")) |> Bytes.of_string in
  Printf.printf "File size: %d bytes\n" (Bytes.length bytes);
  
  let noun = Serial.cue bytes in
  Printf.printf "Cued successfully\n";
  Printf.printf "Is atom: %b\n" (Noun.is_atom noun);
  Printf.printf "Is cell: %b\n" (Noun.is_cell noun);
  
  if Noun.is_cell noun then begin
    let h = Noun.head noun in
    let t = Noun.tail noun in
    Printf.printf "Head is atom: %b\n" (Noun.is_atom h);
    Printf.printf "Tail is atom: %b\n" (Noun.is_atom t)
  end