aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2014-09-09 10:27:51 +0200
committerHans Nilsson <[email protected]>2014-09-09 10:27:51 +0200
commit945231848e54174ad67a28c5a137179dc96b3d6d (patch)
treeec7d5a2e6f59aa155e027f12d131d754baa1f205 /lib/common_test
parent4608ccd9b76f43f877f414742f9a469de15bea5c (diff)
parenta146b28e6b17dbd2cae9ef090e5950985ec9dfe9 (diff)
downloadotp-945231848e54174ad67a28c5a137179dc96b3d6d.tar.gz
otp-945231848e54174ad67a28c5a137179dc96b3d6d.tar.bz2
otp-945231848e54174ad67a28c5a137179dc96b3d6d.zip
Merge branch 'maint'
* maint: ssh: update for triq tests common_test: ct_property_test call correct Triq function. ct_property_test: add Triq support
Diffstat (limited to 'lib/common_test')
-rw-r--r--lib/common_test/src/ct_property_test.erl20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/common_test/src/ct_property_test.erl b/lib/common_test/src/ct_property_test.erl
index e401fef669..39d089f04c 100644
--- a/lib/common_test/src/ct_property_test.erl
+++ b/lib/common_test/src/ct_property_test.erl
@@ -78,7 +78,8 @@
%%%
%%% @doc Initializes Config for property testing.
%%%
-%%% <p>The function investigates if support is available for either Quickcheck or PropEr.
+%%% <p>The function investigates if support is available for either Quickcheck, PropEr,
+%%% or Triq.
%%% The options <c>{property_dir,AbsPath}</c> and
%%% <c>{property_test_tool,Tool}</c> is set in the Config returned.</p>
%%% <p>The function is intended to be called in the init_per_suite in the test suite.</p>
@@ -86,7 +87,7 @@
%%% @end
init_per_suite(Config) ->
- case which_module_exists([eqc,proper]) of
+ case which_module_exists([eqc,proper,triq]) of
{ok,ToolModule} ->
ct:pal("Found property tester ~p",[ToolModule]),
Path = property_tests_path("property_test", Config),
@@ -114,7 +115,8 @@ init_per_suite(Config) ->
quickcheck(Property, Config) ->
Tool = proplists:get_value(property_test_tool,Config),
- mk_ct_return( Tool:quickcheck(Property) ).
+ F = function_name(quickcheck, Tool),
+ mk_ct_return( Tool:F(Property), Tool ).
%%%================================================================
@@ -123,10 +125,10 @@ quickcheck(Property, Config) ->
%%%
%%% Make return values back to the calling Common Test suite
-mk_ct_return(true) ->
+mk_ct_return(true, _Tool) ->
true;
-mk_ct_return(Other) ->
- try lists:last(hd(eqc:counterexample()))
+mk_ct_return(Other, Tool) ->
+ try lists:last(hd(Tool:counterexample()))
of
{set,{var,_},{call,M,F,Args}} ->
{fail, io_lib:format("~p:~p/~p returned bad result",[M,F,length(Args)])}
@@ -174,5 +176,9 @@ compile_tests(Path, ToolModule) ->
macro_def(eqc) -> [{d, 'EQC'}];
-macro_def(proper) -> [{d, 'PROPER'}].
+macro_def(proper) -> [{d, 'PROPER'}];
+macro_def(triq) -> [{d, 'TRIQ'}].
+
+function_name(quickcheck, triq) -> check;
+function_name(F, _) -> F.