File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 8
8
9
9
}
10
10
"\007\000,\000\000\190\239abcdefgh"
11
+ with_ignored_field = {
12
+ a = 0x1
13
+ _b = 0x2
14
+ c = 0x3
15
+
16
+ }
Original file line number Diff line number Diff line change @@ -72,6 +72,20 @@ type unused = {
72
72
} [@@ big_endian]
73
73
]
74
74
75
+ let set_with_ignored_field__b = true
76
+
77
+ let _ : bool = set_with_ignored_field__b
78
+
79
+ [%% cstruct
80
+ type with_ignored_field = {
81
+ a : uint8_t ;
82
+ _b : uint8_t ;
83
+ c : uint8_t ;
84
+ } [@@ little_endian]
85
+ ]
86
+
87
+ let _ : Cstruct.t -> int -> unit = set_with_ignored_field__b
88
+
75
89
let tests () =
76
90
(* Test basic set/get functions *)
77
91
let be = Cstruct. of_bigarray (Bigarray. (Array1. create char c_layout sizeof_foo)) in
@@ -151,6 +165,7 @@ let tests () =
151
165
assert (get_foo_b be = 44 );
152
166
assert (get_foo_a be = 7 );
153
167
hexdump_foo be;
154
- print_endline (Sexplib.Sexp. to_string_hum (Cstruct. sexp_of_t be))
168
+ print_endline (Sexplib.Sexp. to_string_hum (Cstruct. sexp_of_t be));
169
+ hexdump_with_ignored_field (Cstruct. of_hex " 010203" )
155
170
156
171
let () = tests ()
You can’t perform that action at this time.
0 commit comments