mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
test: better regression test for #454
This commit is contained in:
parent
c959e396b3
commit
69f0e9b624
5 changed files with 15 additions and 13 deletions
3
Makefile
3
Makefile
|
|
@ -6,7 +6,8 @@ build:
|
||||||
dune build @install -p $(PACKAGES)
|
dune build @install -p $(PACKAGES)
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
dune runtest --display=quiet --cache=disabled --no-buffer --force
|
# run tests in release mode to expose bug in #454
|
||||||
|
dune runtest --display=quiet --cache=disabled --no-buffer --force --profile=release
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
dune clean
|
dune clean
|
||||||
|
|
|
||||||
5
tests/core/reg/dune
Normal file
5
tests/core/reg/dune
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
(tests
|
||||||
|
(ocamlopt_flags :standard -inline 1000)
|
||||||
|
(names t_reg454)
|
||||||
|
(libraries containers))
|
||||||
0
tests/core/reg/t_reg454.expected
Normal file
0
tests/core/reg/t_reg454.expected
Normal file
8
tests/core/reg/t_reg454.ml
Normal file
8
tests/core/reg/t_reg454.ml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
module Vec = CCVector
|
||||||
|
|
||||||
|
let () =
|
||||||
|
let arr : Int32.t Vec.vector = Vec.create () in
|
||||||
|
Vec.push arr (Int32.of_int 123456);
|
||||||
|
Format.printf "%d\n" (Int32.to_int (Vec.get arr 0));
|
||||||
|
let x = Vec.get arr 0 in
|
||||||
|
Format.printf "%d\n" (Int32.to_int x)
|
||||||
|
|
@ -753,15 +753,3 @@ push v 0;
|
||||||
push v 0;
|
push v 0;
|
||||||
push v 0;
|
push v 0;
|
||||||
6 = foldi (fun i acc _ -> acc + i) 0 v
|
6 = foldi (fun i acc _ -> acc + i) 0 v
|
||||||
;;
|
|
||||||
|
|
||||||
t ~name:"reg454" @@ fun () ->
|
|
||||||
let arr : Int32.t vector = create () in
|
|
||||||
CCVector.push arr (Int32.of_int 123456);
|
|
||||||
let s = spf "%d\n" (Int32.to_int (CCVector.get arr 0)) in
|
|
||||||
Printf.eprintf "%d\n" (Int32.to_int (CCVector.get arr 0));
|
|
||||||
let x = CCVector.get arr 0 in
|
|
||||||
let s2 = spf "%d\n" (Int32.to_int x) in
|
|
||||||
Printf.eprintf "%d\n" (Int32.to_int x);
|
|
||||||
assert_equal ~printer:(spf "%S") s s2;
|
|
||||||
true
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue