1

My ocaml setting is the following :

  • ocaml 4.01.0
  • opam 1.1.2
  • qtest 2.0.1 (opam list qtest)
  • quickcheck 1.0.0

The source code with test inlined :

let rec foo x0 f = function
        [] -> 0
        | x::xs -> f x (foo x0 f xs);;

(*$T foo
        foo 0 (+) [1;2] = 3
*)

qtest -o footest2.ml extract foo.ml

Then unfortunately, footest2.ml fails to compile:

corebuild footest2.native -pkg quickcheck

let ___tests = ref []
let ___add test = ___tests := test::!___tests
open OUnit;;
module Q = Quickcheck;;let ( ==> ) = Q.( ==> );;
Random.self_init()



module Test__environment_0 = struct
open Foo;;
let _test_2 = "foo" >::: [
"foo.ml:6" >:: (
#6 "foo.ml"
let foo = foo in fun () -> OUnit.assert_bool "foo.ml:6:  foo 0 (+) [1;2] = 3" (
#6 "foo.ml"
        foo 0 (+) [1;2] = 3));
];; let _ = ___add _test_2;;
end

let _ = exit (Runner.run ("" >::: List.rev !___tests))

the error being: "Error: Unbound module Quickcheck"

Indeed, it should be QuickCheck instead of Quickcheck - after fixing this, I got the error : Error: Unbound value Q.==>. After removal of :

let ( ==> ) = Q.( ==> );;

The compilation fails later : Error: Unbound module Runner.

But no module called "Runner"...

Any idea to get this working?

Unihedron
  • 10,902
  • 13
  • 62
  • 72
Pierre G.
  • 4,346
  • 1
  • 12
  • 25
  • After some search on the net, there is quick**c**heck and quick**C**heck (lower case vs upper case). qtest is tied with quickcheck - and both are available at that location : https://github.com/vincent-hugot/iTeML/tree/master/qtest. whereas quickCheck is coming from Jane Street in the core : http://ocaml.janestreet.com/ocaml-core/109.09.00/doc/core . The point is that quickcheck that is obtained via opam is not the quickCheck expected by qtest. It looks like the only way to have both is to install qtest from the link above in a separate dir than .opam . – Pierre G. Oct 24 '14 at 19:08

1 Answers1

1

Try using the package QTest2Lib instead of qtest or quickcheck:

corebuild footest2.native -pkg QTest2Lib
Julian Squires
  • 437
  • 4
  • 8