Skip to content

Commit

Permalink
add more test cases and hook them into oasis
Browse files Browse the repository at this point in the history
  • Loading branch information
avsm committed Apr 27, 2016
1 parent 6164a98 commit bac1d53
Show file tree
Hide file tree
Showing 5 changed files with 287 additions and 31 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Remove camlp4 extension as it is no longer maintained (#95).
* Add support for OCaml 4.03 in the PPX extension (#96).
* Minimum supported OCaml version for the library is now 4.02.3.
* Fix parsing of high int32 `@@enum` values.

1.9.0 (2016-02-19):
* Add support for a ppx-based extension that uses the extension point
Expand Down
38 changes: 34 additions & 4 deletions _oasis
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,48 @@ Test test_bounds
Run: true
WorkingDirectory: _build/lib/

Executable test_ppx
Executable test_ppx_basic
Build$: flag(tests) && flag(ppx)
Install: false
Path: ppx_test
Custom: true
CompiledObject: best
BuildTools: ppx_cstruct
BuildDepends: cstruct, unix, oUnit, cstruct.unix
MainIs: tests.ml
MainIs: basic.ml

Executable test_ppx_enum
Build$: flag(tests) && flag(ppx)
Install: false
Path: ppx_test
Custom: true
CompiledObject: best
BuildTools: ppx_cstruct
BuildDepends: cstruct, unix, oUnit, cstruct.unix
MainIs: enum.ml

Executable test_ppx_pcap
Build$: flag(tests) && flag(ppx)
Install: false
Path: ppx_test
Custom: true
CompiledObject: best
BuildTools: ppx_cstruct
BuildDepends: cstruct, unix, oUnit, cstruct.unix
MainIs: pcap.ml

Test test_ppx_pcap
Command: $test_ppx_pcap
Run$: flag(ppx)
WorkingDirectory: ppx_test

Test test_ppx_basic
Command: $test_ppx_basic
Run$: flag(ppx)
WorkingDirectory: ppx_test

Test test_ppx
Command: $test_ppx
Test test_ppx_enum
Command: $test_ppx_enum
Run$: flag(ppx)
WorkingDirectory: ppx_test

Expand Down
52 changes: 38 additions & 14 deletions _tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: 67701b7c18374cb388ad9258d6120134)
# DO NOT EDIT (digest: 514db63fd66b2beab5efac3ce24087f9)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
Expand Down Expand Up @@ -76,17 +76,41 @@ true: annot, bin_annot
<lib_test/*.ml{,i,y}>: pkg_unix
<lib_test/*.ml{,i,y}>: use_unix_cstruct
<lib_test/bounds.{native,byte}>: custom
# Executable test_ppx
<ppx_test/tests.{native,byte}>: pkg_bigarray
<ppx_test/tests.{native,byte}>: pkg_bytes
<ppx_test/tests.{native,byte}>: pkg_oUnit
<ppx_test/tests.{native,byte}>: pkg_ocplib-endian
<ppx_test/tests.{native,byte}>: pkg_ocplib-endian.bigstring
<ppx_test/tests.{native,byte}>: pkg_ppx_tools.metaquot
<ppx_test/tests.{native,byte}>: pkg_sexplib
<ppx_test/tests.{native,byte}>: pkg_unix
<ppx_test/tests.{native,byte}>: use_cstruct
<ppx_test/tests.{native,byte}>: use_unix_cstruct
# Executable test_ppx_basic
<ppx_test/basic.{native,byte}>: pkg_bigarray
<ppx_test/basic.{native,byte}>: pkg_bytes
<ppx_test/basic.{native,byte}>: pkg_oUnit
<ppx_test/basic.{native,byte}>: pkg_ocplib-endian
<ppx_test/basic.{native,byte}>: pkg_ocplib-endian.bigstring
<ppx_test/basic.{native,byte}>: pkg_ppx_tools.metaquot
<ppx_test/basic.{native,byte}>: pkg_sexplib
<ppx_test/basic.{native,byte}>: pkg_unix
<ppx_test/basic.{native,byte}>: use_cstruct
<ppx_test/basic.{native,byte}>: use_unix_cstruct
<ppx_test/basic.{native,byte}>: custom
# Executable test_ppx_enum
<ppx_test/enum.{native,byte}>: pkg_bigarray
<ppx_test/enum.{native,byte}>: pkg_bytes
<ppx_test/enum.{native,byte}>: pkg_oUnit
<ppx_test/enum.{native,byte}>: pkg_ocplib-endian
<ppx_test/enum.{native,byte}>: pkg_ocplib-endian.bigstring
<ppx_test/enum.{native,byte}>: pkg_ppx_tools.metaquot
<ppx_test/enum.{native,byte}>: pkg_sexplib
<ppx_test/enum.{native,byte}>: pkg_unix
<ppx_test/enum.{native,byte}>: use_cstruct
<ppx_test/enum.{native,byte}>: use_unix_cstruct
<ppx_test/enum.{native,byte}>: custom
# Executable test_ppx_pcap
<ppx_test/pcap.{native,byte}>: pkg_bigarray
<ppx_test/pcap.{native,byte}>: pkg_bytes
<ppx_test/pcap.{native,byte}>: pkg_oUnit
<ppx_test/pcap.{native,byte}>: pkg_ocplib-endian
<ppx_test/pcap.{native,byte}>: pkg_ocplib-endian.bigstring
<ppx_test/pcap.{native,byte}>: pkg_ppx_tools.metaquot
<ppx_test/pcap.{native,byte}>: pkg_sexplib
<ppx_test/pcap.{native,byte}>: pkg_unix
<ppx_test/pcap.{native,byte}>: use_cstruct
<ppx_test/pcap.{native,byte}>: use_unix_cstruct
<ppx_test/*.ml{,i,y}>: pkg_bigarray
<ppx_test/*.ml{,i,y}>: pkg_bytes
<ppx_test/*.ml{,i,y}>: pkg_oUnit
Expand All @@ -97,7 +121,7 @@ true: annot, bin_annot
<ppx_test/*.ml{,i,y}>: pkg_unix
<ppx_test/*.ml{,i,y}>: use_cstruct
<ppx_test/*.ml{,i,y}>: use_unix_cstruct
<ppx_test/tests.{native,byte}>: custom
<ppx_test/pcap.{native,byte}>: custom
# Executable misc_tests
<lib_test/tests.{native,byte}>: pkg_bigarray
<lib_test/tests.{native,byte}>: pkg_bytes
Expand All @@ -116,4 +140,4 @@ true: annot, bin_annot
<lib_test/tests.{native,byte}>: custom
# OASIS_STOP
true: annot, bin_annot, debug, principal
<ppx_test/*.ml>: ppx(ppx_cstruct)
<ppx_test/*.ml>: ppx(./ppx/ppx_cstruct.native)
19 changes: 19 additions & 0 deletions ppx_test/basic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ type bar = {
} [@@big_endian]
]

[%%cstruct
type lbar = {
a : uint8_t;
b : uint16_t;
c : uint32_t;
d : uint8_t [@len 8]
} [@@little_endian]
]

(* see #72
[%%cstruct
type hbar = {
a : uint8_t;
b : uint16_t;
c : uint32_t;
d : uint8_t [@len 8]
} [@@host_endian]
]
*)
let tests () =
(* Test basic set/get functions *)
let be = Cstruct.of_bigarray (Bigarray.(Array1.create char c_layout sizeof_foo)) in
Expand Down
Loading

0 comments on commit bac1d53

Please sign in to comment.