Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests on 32bit arch #250

Merged
merged 7 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@

- add environment variable `QCHECK_LONG_FACTOR` similar to `QCHECK_COUNT` [#220](https://github.com/c-cube/qcheck/pull/220)

- make test suite run on 32-bit architectures

## 0.18.1

- fix `Gen.{nat,pos}_split{2,}`
Expand Down
15 changes: 11 additions & 4 deletions example/alcotest/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
(* -*- tuareg -*- *)

let dune = Printf.sprintf {|

(executable
(name QCheck_alcotest_test)
Expand All @@ -6,18 +9,22 @@
(rule
(targets output.txt)
(deps ./QCheck_alcotest_test.exe)
(enabled_if (= %{os_type} "Unix"))
(enabled_if (= %%{os_type} "Unix"))
(action
(with-accepted-exit-codes
1
(setenv
QCHECK_SEED 1234
(with-stdout-to
%{targets}
%%{targets}
(run ./run_alcotest.sh --color=never))))))

(rule
(alias runtest)
(package qcheck-alcotest)
(enabled_if (= %{os_type} "Unix"))
(action (diff output.txt.expected output.txt)))
(enabled_if (= %%{os_type} "Unix"))
(action (diff output.txt.expected.%i output.txt)))

|} Sys.word_size

let () = Jbuild_plugin.V1.send dune
80 changes: 80 additions & 0 deletions example/alcotest/output.txt.expected.32
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
qcheck random seed: 1234
Testing `my test'.
[OK] suite 0 list_rev_is_involutive.
[FAIL] suite 1 fail_sort_id.
[FAIL] suite 2 error_raise_exn.
[OK] suite 3 neg test pass (failing as expected).
[FAIL] suite 4 neg test unexpected success.
[FAIL] suite 5 neg fail with error.
[FAIL] suite 6 fail_check_err_message.
[OK] suite 7 tree_rev_is_involutive.
[FAIL] shrinking 0 debug_shrink.
┌──────────────────────────────────────────────────────────────────────────────┐
│ [FAIL] suite 1 fail_sort_id. │
└──────────────────────────────────────────────────────────────────────────────┘
test `fail_sort_id` failed on ≥ 1 cases: [1; 0] (after 11 shrink steps)
[exception] test `fail_sort_id` failed on ≥ 1 cases: [1; 0] (after 11 shrink steps)
──────────────────────────────────────────────────────────────────────────────
┌──────────────────────────────────────────────────────────────────────────────┐
│ [FAIL] suite 2 error_raise_exn. │
└──────────────────────────────────────────────────────────────────────────────┘
test `error_raise_exn`
raised exception `Error`
on `0 (after 31 shrink steps)`
[exception] test `error_raise_exn`
raised exception `Error`
on `0 (after 31 shrink steps)`
──────────────────────────────────────────────────────────────────────────────
┌──────────────────────────────────────────────────────────────────────────────┐
│ [FAIL] suite 4 neg test unexpected success. │
└──────────────────────────────────────────────────────────────────────────────┘
negative test 'neg test unexpected success' succeeded unexpectedly
ASSERT negative test 'neg test unexpected success' succeeded unexpectedly
FAIL negative test 'neg test unexpected success' succeeded unexpectedly
──────────────────────────────────────────────────────────────────────────────
┌──────────────────────────────────────────────────────────────────────────────┐
│ [FAIL] suite 5 neg fail with error. │
└──────────────────────────────────────────────────────────────────────────────┘
test `neg fail with error`
raised exception `Error`
on `0 (after 7 shrink steps)`
[exception] test `neg fail with error`
raised exception `Error`
on `0 (after 7 shrink steps)`
──────────────────────────────────────────────────────────────────────────────
┌──────────────────────────────────────────────────────────────────────────────┐
│ [FAIL] suite 6 fail_check_err_message. │
└──────────────────────────────────────────────────────────────────────────────┘
test `fail_check_err_message` failed on ≥ 1 cases:
0 (after 7 shrink steps)
this
will
always
fail
[exception] test `fail_check_err_message` failed on ≥ 1 cases:
0 (after 7 shrink steps)
this
will
always
fail
──────────────────────────────────────────────────────────────────────────────
┌──────────────────────────────────────────────────────────────────────────────┐
│ [FAIL] shrinking 0 debug_shrink. │
└──────────────────────────────────────────────────────────────────────────────┘
~~~ Shrink ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test debug_shrink successfully shrunk counter example (step 0) to:
(3, 1)
~~~ Shrink ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test debug_shrink successfully shrunk counter example (step 1) to:
(2, 1)
~~~ Shrink ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test debug_shrink successfully shrunk counter example (step 2) to:
(2, 0)
~~~ Shrink ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test debug_shrink successfully shrunk counter example (step 3) to:
(1, 0)
law debug_shrink: 2 relevant cases (2 total)
test `debug_shrink` failed on ≥ 1 cases: (1, 0) (after 3 shrink steps)
[exception] test `debug_shrink` failed on ≥ 1 cases: (1, 0) (after 3 shrink steps)
──────────────────────────────────────────────────────────────────────────────
6 failures! 9 tests run.
15 changes: 11 additions & 4 deletions example/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
(* -*- tuareg -*- *)

let dune = Printf.sprintf {|

(executables
(names QCheck_runner_test)
Expand All @@ -6,16 +9,20 @@
(rule
(targets output.txt)
(deps ./QCheck_runner_test.exe)
(enabled_if (= %{os_type} "Unix"))
(enabled_if (= %%{os_type} "Unix"))
(action
(with-accepted-exit-codes
1
(with-stdout-to
%{targets}
%%{targets}
(run ./QCheck_runner_test.exe --no-colors -s 1234)))))

(rule
(alias runtest)
(enabled_if (= %{os_type} "Unix"))
(enabled_if (= %%{os_type} "Unix"))
(package qcheck)
(action (diff output.txt.expected output.txt)))
(action (diff output.txt.expected.%i output.txt)))

|} Sys.word_size

let () = Jbuild_plugin.V1.send dune
15 changes: 11 additions & 4 deletions example/ounit/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
(* -*- tuareg -*- *)

let dune = Printf.sprintf {|

(executables
(names QCheck_ounit_test QCheck_test)
Expand All @@ -6,16 +9,20 @@
(rule
(targets output.txt)
(deps ./QCheck_ounit_test.exe)
(enabled_if (= %{os_type} "Unix"))
(enabled_if (= %%{os_type} "Unix"))
(action
(with-accepted-exit-codes
1
(with-stdout-to
%{targets}
%%{targets}
(run ./run_ounit.sh -runner=sequential -seed 1234)))))

(rule
(alias runtest)
(package qcheck-ounit)
(enabled_if (= %{os_type} "Unix"))
(action (diff output.txt.expected output.txt)))
(enabled_if (= %%{os_type} "Unix"))
(action (diff output.txt.expected.%i output.txt)))

|} Sys.word_size

let () = Jbuild_plugin.V1.send dune
65 changes: 65 additions & 0 deletions example/ounit/output.txt.expected.32
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.FE.FEF.
==============================================================================
Error: tests:5:neg fail with error.

Error: tests:5:neg fail with error (in the log).


test `neg fail with error`
raised exception `Dune__exe__QCheck_ounit_test.Error`
on `0 (after 7 shrink steps)`

------------------------------------------------------------------------------
==============================================================================
Error: tests:2:error_raise_exn.

Error: tests:2:error_raise_exn (in the log).


test `error_raise_exn` raised exception `Dune__exe__QCheck_ounit_test.Error`
on `0 (after 31 shrink steps)`

------------------------------------------------------------------------------
==============================================================================
Error: tests:6:fail_check_err_message.

Error: tests:6:fail_check_err_message (in the log).

Error: tests:6:fail_check_err_message (in the code).


test `fail_check_err_message` failed on ≥ 1 cases:
0 (after 7 shrink steps)
this
will
always
fail



------------------------------------------------------------------------------
==============================================================================
Error: tests:4:neg test unexpected success.

Error: tests:4:neg test unexpected success (in the log).

Error: tests:4:neg test unexpected success (in the code).


negative test 'neg test unexpected success' succeeded unexpectedly

------------------------------------------------------------------------------
==============================================================================
Error: tests:1:fail_sort_id.

Error: tests:1:fail_sort_id (in the log).

Error: tests:1:fail_sort_id (in the code).


test `fail_sort_id` failed on ≥ 1 cases: [1; 0] (after 11 shrink steps)


------------------------------------------------------------------------------
Ran: 8 tests in: <nondet> seconds.
FAILED: Cases: 8 Tried: 8 Errors: 2 Failures: 3 Skip: 0 Todo: 0 Timeouts: 0.
File renamed without changes.
Loading