Permalink
Browse files

Merge commit '4358b4b22af1b02e0a25'

  • Loading branch information...
2 parents 9b4e480 + 4358b4b commit ad3df56d32986134c9597c6a2884cb8e58b2b433 @krestenkrab committed Jun 15, 2010
Showing with 28 additions and 0 deletions.
  1. +24 −0 README.markdown
  2. +4 −0 src/triq_tests.erl
View
@@ -65,6 +65,30 @@ Simplified:
false
2> </pre>
+You can get the values used for the failing test with `counterexample`,
+and reuse the same test values with `check/2`:
+<pre>3> A = triq:counterexample(triq_tests:xprop_delete()).
+x.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxFailed!
+L=[3,2,1,1,1], I=1
+
+Failed after 101 tests with false
+Simplified:
+ L = [0,0]
+ I = 0
+[[0,0],0]
+4> A.
+[[0,0],0]
+5> triq:check(triq_tests:xprop_delete(), A).
+Failed!
+L=[0,0], I=0
+
+Failed after 1 tests with false
+Simplified:
+ L = [0,0]
+ I = 0
+false
+6> </pre>
+
Modules compiled with the `triq.hrl` header, auto-export all functions named `prop_*`,
and have a function added called `check/0` which runs `triq:check/1` on all the properties in the module.
View
@@ -203,3 +203,7 @@ recheck_test_() ->
Bad = [[1,1], 1],
[?_assertEqual(true, triq:check(xprop_delete(), Good)),
?_assertEqual(false, triq:check(xprop_delete(), Bad))].
+
+counterexample_test() ->
+ Counterexample = triq:counterexample(xprop_delete()),
+ ?assertEqual(false, triq:check(xprop_delete(), Counterexample)).

0 comments on commit ad3df56

Please sign in to comment.