Skip to content
Browse files

Make some shell helpers for the EQC property, idea from @russelldb

  • Loading branch information...
1 parent 98e331c commit 0e0119e2afaff286821f7cb5961e2ac882eca546 @seancribbs seancribbs committed Feb 27, 2013
Showing with 23 additions and 2 deletions.
  1. +23 −2 test/bucket_props_codec_eqc.erl
View
25 test/bucket_props_codec_eqc.erl
@@ -28,12 +28,18 @@
io:format(user, F, TL)
end, P)).
+%%====================================================================
+%% Eunit integration
+%%====================================================================
bucket_codec_test_() ->
- [{"bucket properties encode decode",
+ [{"bucket properties encode decode",
?_test(begin
- quickcheck(?QC_OUT(numtests(2000, prop_codec())))
+ eqc:quickcheck(?QC_OUT(eqc:numtests(2000, prop_codec())))
end)}].
+%%====================================================================
+%% Properties
+%%====================================================================
prop_codec() ->
?FORALL(Props, sortuniq(list(bucket_prop())),
?WHENFAIL(begin
@@ -47,6 +53,21 @@ prop_codec() ->
Props =:= lists:sort(Props2)
end)).
+%%====================================================================
+%% Shell helpers
+%%====================================================================
+qc() ->
+ qc(2000).
+
+qc(NumTests) ->
+ quickcheck(numtests(NumTests, prop_codec())).
+
+check() ->
+ eqc:check(prop_codec(), eqc:current_counterexample()).
+
+%%====================================================================
+%% Generators
+%%====================================================================
bucket_prop() ->
oneof([num(n_val),
flag(allow_mult),

0 comments on commit 0e0119e

Please sign in to comment.
Something went wrong with that request. Please try again.