Re: Some guidance on how to write good property tests with test.check?

2015-03-29 Thread mynomoto
Hi John, Here's what I would do: ``` (def gen-data-invalid (gen/hash-map :vec (gen/vector gen/string 0 1))) (def gen-data-valid (gen/hash-map :vec (gen/vector gen/string 2 100))) (deftest valid-vector-test (checking data with at least 2 elements in :vec 100 [d gen-data-valid] (is

Re: Some guidance on how to write good property tests with test.check?

2015-03-28 Thread andrea crotti
I think this is almost borderline to be too trivial to test, and definitively rewriting the same logic in the test is normally not a good idea.. I would just consider on some simple cases and on the the corner cases. For example: (is (false (valid-vector? {:vec []})) (is (true (valid-vector?

Re: Some guidance on how to write good property tests with test.check?

2015-03-28 Thread Juvenn Woo
Hi John, since it's a simple predicate, we can test what cases will result true, and what false. E.g. : (is (false (valid-vector? [])) (is (false (valid-vector? [:a])) (is (false (valid-vector? [1])) (is (true (valid-vector? [:a 1])) Practically, I do feel it's a bit unnecessary to use

Some guidance on how to write good property tests with test.check?

2015-03-27 Thread John Louis Del Rosario
I have a function I want to try out test.check on. But I'm having trouble grokking how to write the tests. Basically the function checks if a vector value in a hash-map has at least 2 elements. (defn valid-vector? [d] (= 2 (count (:vec d and in my tests (I'm using test.chuck