File tree Expand file tree Collapse file tree 9 files changed +1938
-42
lines changed Expand file tree Collapse file tree 9 files changed +1938
-42
lines changed Original file line number Diff line number Diff line change 1
- (executables
1
+ (executable
2
2
(libraries cstruct alcotest)
3
- (names tests bounds ))
3
+ (name tests))
4
4
5
5
(alias
6
6
(name runtest)
7
7
(package cstruct)
8
- (deps
9
- (:< tests.exe))
10
8
(action
11
- (run %{<} -e)))
9
+ (run ./tests.exe -e)))
Original file line number Diff line number Diff line change
1
+ deadbeef deadbeef
2
+ foo = {
3
+ a = 0x7
4
+ b = 0x2c
5
+ c = 0xbeef
6
+ d = <buffer uint8_t[8] d>
7
+ 61 62 63 64 65 66 67 68
8
+
9
+ }
10
+ "\007\000,\000\000\190\239abcdefgh"
Original file line number Diff line number Diff line change @@ -107,12 +107,12 @@ let tests () =
107
107
let bibe = Cstruct. of_bigarray (Bigarray. (Array1. create char c_layout BE. sizeof_bibar)) in
108
108
for i = 0 to 65535 do
109
109
BE. set_bibar_a bibe i;
110
- assert (BE. get_bibar_a bibe = i)
110
+ assert (BE. get_bibar_a bibe = i mod 256 )
111
111
done ;
112
112
let bile = Cstruct. of_bigarray (Bigarray. (Array1. create char c_layout LE. sizeof_bibar)) in
113
113
for i = 0 to 65535 do
114
114
LE. set_bibar_a bile i;
115
- assert (LE. get_bibar_a bile = i)
115
+ assert (LE. get_bibar_a bile = i mod 256 )
116
116
done ;
117
117
let be = Cstruct. of_bigarray (Bigarray. (Array1. create char c_layout sizeof_foo)) in
118
118
let rec fn = function
@@ -152,3 +152,5 @@ let tests () =
152
152
assert (get_foo_a be = 7 );
153
153
hexdump_foo be;
154
154
print_endline (Sexplib.Sexp. to_string_hum (Cstruct. sexp_of_t be))
155
+
156
+ let () = tests ()
Original file line number Diff line number Diff line change 1
- (executables
1
+ (tests
2
+ (names pcap basic enum)
3
+ (deps http.cap)
2
4
(libraries cstruct-unix)
3
- (preprocess
4
- (pps ppx_cstruct))
5
- (names pcap basic enum))
6
-
7
- (alias
8
- (name runtest)
9
- (package ppx_cstruct)
10
- (deps
11
- (:< pcap.exe))
12
- (action
13
- (run %{<})))
14
-
15
- (alias
16
- (name runtest)
17
- (package ppx_cstruct)
18
- (deps
19
- (:< basic.exe))
20
- (action
21
- (run %{<})))
22
-
23
- (alias
24
- (name runtest)
25
- (package ppx_cstruct)
26
- (deps
27
- (:< enum.exe))
28
- (action
29
- (run %{<})))
5
+ (preprocess (pps ppx_cstruct))
6
+ (package ppx_cstruct))
Original file line number Diff line number Diff line change @@ -80,3 +80,5 @@ let tests () =
80
80
assert (int_to_foo32 0xffffffffl = Some (THREE32 ));
81
81
assert (string_to_foo16 " ONE16" = Some ONE16 );
82
82
assert (foo8_to_string ONE8 = " ONE8" )
83
+
84
+ let () = tests ()
You can’t perform that action at this time.
0 commit comments