diff options
author | Hans Nilsson <hans@erlang.org> | 2019-12-17 15:47:10 +0100 |
---|---|---|
committer | Hans Nilsson <hans@erlang.org> | 2020-01-07 13:03:56 +0100 |
commit | 610e8bb1d9bcf7f31e2839a178e5ef3df0b541cb (patch) | |
tree | 65d8ef2bebc2864955e09876a6c3c47930082c68 /lib/common_test/test | |
parent | eb52758f7fc76dd967f261d66c55c81c10a612de (diff) | |
download | erlang-610e8bb1d9bcf7f31e2839a178e5ef3df0b541cb.tar.gz |
common_test: Add 'prop_tools' option to Config for ct_property_test
Diffstat (limited to 'lib/common_test/test')
-rw-r--r-- | lib/common_test/test/property_test/ct_prop.erl | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/common_test/test/property_test/ct_prop.erl b/lib/common_test/test/property_test/ct_prop.erl index 559c33da74..67ab3f3e6b 100644 --- a/lib/common_test/test/property_test/ct_prop.erl +++ b/lib/common_test/test/property_test/ct_prop.erl @@ -8,21 +8,11 @@ prop_sort() -> is_sorted(lists:sort(UnSorted)) ). - is_sorted([]) -> true; is_sorted([_]) -> true; -is_sorted(Sorted) -> - try - lists:foldl(fun chk_sorted_pair/2, hd(Sorted), tl(Sorted)) - of - _ -> - true - catch - throw:false -> - false - end. - -chk_sorted_pair(A, B) when A>=B -> A; -chk_sorted_pair(_, _) -> throw(false). +is_sorted([H1,H2|SortedTail]) when H1 =< H2 -> + is_sorted([H2|SortedTail]); +is_sorted(_) -> + false. |