Skip to content

Commit aa0b15e

Browse files
committed
test
1 parent a4d9639 commit aa0b15e

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

test/twine/t12.expected

+25
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
=== test n_items=10
2+
raw value:
3+
[0x0]: ["hello 0", null] (len=2)
4+
[0xa]: [ref(0x0)] (len=1)
5+
[0xc]: ["hello 1", @0xa] (len=2)
6+
[0x16]: [ref(0xc)] (len=1)
7+
[0x18]: ["hello 2", @0x16] (len=2)
8+
[0x22]: [ref(0x18)] (len=1)
9+
[0x24]: ["hello 3", @0x22] (len=2)
10+
[0x2e]: [ref(0x24)] (len=1)
11+
[0x30]: ["hello 4", @0x2e] (len=2)
12+
[0x3a]: [ref(0x30)] (len=1)
13+
[0x3c]: ["hello 5", @0x3a] (len=2)
14+
[0x46]: [ref(0x3c)] (len=1)
15+
[0x48]: ["hello 6", @0x46] (len=2)
16+
[0x52]: [ref(0x48)] (len=1)
17+
[0x54]: ["hello 7", @0x52] (len=2)
18+
[0x5e]: [ref(0x54)] (len=1)
19+
[0x60]: ["hello 8", @0x5e] (len=2)
20+
[0x6a]: [ref(0x60)] (len=1)
21+
[0x6c]: ["hello 9", @0x6a] (len=2)
22+
[0x76]: [ref(0x0), ref(0xc), ref(0x18), ref(0x24), ref(0x30), ref(0x3c), ref(0x48), ref(0x54), ref(0x60), ref(0x6c)] (len=10)
23+
124
normal.size=140, flush.size=140
25+
=== test n_items=1000
226
normal.size=16895, flush.size=16895
27+
=== test n_items=100000
328
normal.size=1988897, flush.size=1988897

test/twine/t12.ml

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type foo = {
1212
type foos = { foos: foo Imandrakit_twine.offset_for list }
1313
[@@unboxed] [@@deriving eq, show, twine]
1414

15-
let test ~n_items () =
15+
let test ?(dump = false) ~n_items () =
1616
let open struct
1717
let encoded_normal : string =
1818
let enc = Imandrakit_twine.Encode.create () in
@@ -59,6 +59,10 @@ let test ~n_items () =
5959
Buffer.contents buf
6060

6161
let () =
62+
Printf.printf "=== test n_items=%d\n" n_items;
63+
if dump then
64+
Printf.printf "raw value:\n%s\n"
65+
(Imandrakit_twine.Dump.dump_string encoded_normal);
6266
Printf.printf "normal.size=%d, flush.size=%d\n%!"
6367
(String.length encoded_normal)
6468
(String.length encoded_flush);
@@ -84,6 +88,6 @@ let test ~n_items () =
8488
end in
8589
()
8690

87-
let () = test ~n_items:10 ()
91+
let () = test ~n_items:10 ~dump:true ()
8892
let () = test ~n_items:1_000 ()
8993
let () = test ~n_items:100_000 ()

0 commit comments

Comments
 (0)