Skip to content

Commit 69f2805

Browse files
authored
Merge pull request #414 from c-cube/wip-testlib
custom testlibrary, remove qtest
2 parents f9abed0 + 8d96445 commit 69f2805

File tree

280 files changed

+21077
-18491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+21077
-18491
lines changed

.github/workflows/compat.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ on:
66
branches:
77
- master
88
pull_request:
9-
branches:
10-
- master
119

1210
jobs:
1311
run:

.github/workflows/main.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ on:
55
branches:
66
- master
77
pull_request:
8-
branches:
9-
- master
108

119
jobs:
1210
run:

.ocamlformat

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version = 0.20.1
2+
profile=conventional
3+
margin=80
4+
if-then-else=k-r
5+
parens-ite=true
6+
parens-tuple=multi-line-only
7+
sequence-style=terminator
8+
type-decl=compact
9+
break-cases=toplevel
10+
cases-exp-indent=2
11+
field-space=tight-decl
12+
leading-nested-match-parens=true
13+
module-item-spacing=compact
14+
quiet=true

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,10 @@ You need dune (formerly jbuilder).
266266
$ make
267267
```
268268

269-
To build and run tests (requires `oUnit`, [qtest](https://github.com/vincent-hugot/qtest), `gen`, `iter`):
269+
To build and run tests (requires `qcheck-core`, `gen`, `iter`):
270270

271271
```
272-
$ opam install oUnit qtest
272+
$ opam install qcheck-core
273273
$ make test
274274
```
275275

@@ -302,7 +302,7 @@ to list authors based on the git commits.
302302
Assuming your are in a clone of the repository:
303303

304304
1. Some dependencies are required, you'll need
305-
`opam install benchmark qcheck qtest iter gen mdx uutf`.
305+
`opam install benchmark qcheck-core iter gen mdx uutf`.
306306
2. run `make all` to enable everything (including tests).
307307
3. make your changes, commit, push, and open a PR.
308308
4. use `make test` without moderation! It must pass before a PR
@@ -318,7 +318,7 @@ A few guidelines to follow the philosophy of containers:
318318

319319
- no dependencies between basic modules (even just for signatures);
320320
- add `@since` tags for new functions;
321-
- add tests if possible (using [qtest](https://github.com/vincent-hugot/qtest/)).
321+
- add tests if possible (see `tests/` dir)
322322
There are numerous inline tests already,
323323
to see what it looks like search for comments starting with `(*$`
324324
in source files.

benchs/dune

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
(executables
2-
(names run_benchs run_bench_hash run_objsize)
3-
(libraries containers containers-data
4-
containers-thread benchmark gen iter qcheck oseq
5-
batteries base sek)
6-
(flags :standard -warn-error -3-5 -safe-string -color always -open CCShims_)
7-
(optional)
8-
(ocamlopt_flags :standard -O3 -color always
9-
-unbox-closures -unbox-closures-factor 20))
1+
(executables
2+
(names run_benchs run_bench_hash run_objsize)
3+
(libraries containers containers-data containers-thread benchmark gen iter
4+
qcheck oseq batteries base sek)
5+
(flags :standard -warn-error -3-5 -safe-string -color always -open CCShims_)
6+
(optional)
7+
(ocamlopt_flags :standard -O3 -color always -unbox-closures
8+
-unbox-closures-factor 20))

benchs/objsize.ml

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,50 +22,52 @@ open Obj
2222
(*s Pointers already visited are stored in a hash-table, where
2323
comparisons are done using physical equality. *)
2424

25-
module H = Hashtbl.Make(
26-
struct
27-
type t = Obj.t
28-
let equal = (==)
29-
let hash o = Hashtbl.hash (magic o : int)
30-
end)
25+
module H = Hashtbl.Make (struct
26+
type t = Obj.t
27+
28+
let equal = ( == )
29+
let hash o = Hashtbl.hash (magic o : int)
30+
end)
3131

3232
let node_table = (H.create 257 : unit H.t)
3333

34-
let in_table o = try H.find node_table o; true with Not_found -> false
34+
let in_table o =
35+
try
36+
H.find node_table o;
37+
true
38+
with Not_found -> false
3539

3640
let add_in_table o = H.add node_table o ()
37-
3841
let reset_table () = H.clear node_table
3942

4043
(*s Objects are traversed recursively, as soon as their tags are less than
4144
[no_scan_tag]. [count] records the numbers of words already visited. *)
4245

4346
let size_of_double = size (repr 1.0)
44-
4547
let count = ref 0
4648

4749
let rec traverse t =
48-
if not (in_table t) then begin
50+
if not (in_table t) then (
4951
add_in_table t;
50-
if is_block t then begin
52+
if is_block t then (
5153
let n = size t in
5254
let tag = tag t in
53-
if tag < no_scan_tag then begin
54-
count := !count + 1 + n;
55-
for i = 0 to n - 1 do
56-
let f = field t i in
57-
if is_block f then traverse f
58-
done
59-
end else if tag = string_tag then
60-
count := !count + 1 + n
55+
if tag < no_scan_tag then (
56+
count := !count + 1 + n;
57+
for i = 0 to n - 1 do
58+
let f = field t i in
59+
if is_block f then traverse f
60+
done
61+
) else if tag = string_tag then
62+
count := !count + 1 + n
6163
else if tag = double_tag then
62-
count := !count + size_of_double
64+
count := !count + size_of_double
6365
else if tag = double_array_tag then
64-
count := !count + 1 + size_of_double * n
66+
count := !count + 1 + (size_of_double * n)
6567
else
66-
incr count
67-
end
68-
end
68+
incr count
69+
)
70+
)
6971

7072
(*s Sizes of objects in words and in bytes. The size in bytes is computed
7173
system-independently according to [Sys.word_size]. *)
@@ -76,8 +78,5 @@ let size_w o =
7678
traverse (repr o);
7779
!count
7880

79-
let size_b o = (size_w o) * (Sys.word_size / 8)
80-
81-
let size_kb o = (size_w o) / (8192 / Sys.word_size)
82-
83-
81+
let size_b o = size_w o * (Sys.word_size / 8)
82+
let size_kb o = size_w o / (8192 / Sys.word_size)

0 commit comments

Comments
 (0)