File 7312-stdlib-Modify-property-tests-to-be-run-able-with-Qui.patch of Package erlang

From 3041426a2fa00c5c833931cb135c8413e69491a5 Mon Sep 17 00:00:00 2001
From: Dan Gudmundsson <dgud@erlang.org>
Date: Fri, 27 Feb 2026 16:53:27 +0100
Subject: [PATCH 2/6] stdlib: Modify property tests to be run-able with
 Quickcheck

Most changes had to be done in sets_prop, Quickcheck generated a lot
more int-float problems in the module than what was seen with proper.

Hopefully works now.
---
 lib/stdlib/test/property_test/base64_prop.erl |  15 +-
 lib/stdlib/test/property_test/binary_prop.erl |  65 +--
 .../test/property_test/calendar_prop.erl      |  22 +-
 lib/stdlib/test/property_test/ets_prop.erl    |   7 +-
 .../test/property_test/gb_sets_prop.erl       |  67 ++--
 lib/stdlib/test/property_test/json_prop.erl   |  15 +-
 lib/stdlib/test/property_test/lists_prop.erl  | 379 +++++++++---------
 lib/stdlib/test/property_test/queue_prop.erl  |  45 ++-
 lib/stdlib/test/property_test/sets_prop.erl   | 170 ++++----
 .../test/property_test/shell_docs_prop.erl    |  14 +-
 .../property_test/uri_string_recompose.erl    |  16 +-
 11 files changed, 427 insertions(+), 388 deletions(-)

diff --git a/lib/stdlib/test/property_test/base64_prop.erl b/lib/stdlib/test/property_test/base64_prop.erl
index abc817ba6a..73fdef24ed 100644
--- a/lib/stdlib/test/property_test/base64_prop.erl
+++ b/lib/stdlib/test/property_test/base64_prop.erl
@@ -20,6 +20,7 @@
 %% %CopyrightEnd%
 %%
 -module(base64_prop).
+-compile([export_all, nowarn_export_all]).
 
 -include_lib("common_test/include/ct_property_test.hrl").
 
@@ -30,7 +31,7 @@
 prop_encode_1() ->
     ?FORALL(
         Str,
-        oneof([list(byte()), binary()]),
+        oneof([list(choose(0, 255)), binary()]),
         begin
             Enc = base64:encode(Str),
             Dec = base64:decode(Enc),
@@ -41,7 +42,7 @@ prop_encode_1() ->
 prop_encode_2() ->
     ?FORALL(
         {Str, Mode},
-        {oneof([list(byte()), binary()]), mode()},
+        {oneof([list(choose(0, 255)), binary()]), mode()},
         begin
             Enc = base64:encode(Str, #{mode => Mode}),
             Dec = base64:decode(Enc, #{mode => Mode}),
@@ -52,7 +53,7 @@ prop_encode_2() ->
 prop_encode_to_string_1() ->
     ?FORALL(
         Str,
-        oneof([list(byte()), binary()]),
+        oneof([list(choose(0, 255)), binary()]),
         begin
             Enc = base64:encode_to_string(Str),
             Dec = base64:decode_to_string(Enc),
@@ -63,7 +64,7 @@ prop_encode_to_string_1() ->
 prop_encode_to_string_2() ->
     ?FORALL(
         {Str, Mode},
-        {oneof([list(byte()), binary()]), mode()},
+        {oneof([list(choose(0, 255)), binary()]), mode()},
         begin
             Enc = base64:encode_to_string(Str, #{mode => Mode}),
             Dec = base64:decode_to_string(Enc, #{mode => Mode}),
@@ -247,7 +248,7 @@ common_decode_malformed(DataGen, ModeGen, Fn) ->
                             [b64_char(Mode), b64_char(Mode), b64_char(Mode)]
                         ]
                     ),
-                    function1(boolean())
+                    function1(bool())
                 },
                 {{NormalizedB64, insert_noise(NoisyB64, Malformings, InsertFn)}, Mode}
             )
@@ -309,7 +310,7 @@ b64(Mode) ->
 wsped_b64(Mode) ->
     ?LET(
         {B64, Wsps, InsertFn},
-        {b64(Mode), list(oneof([$\t, $\r, $\n, $\s])), function1(boolean())},
+        {b64(Mode), list(oneof([$\t, $\r, $\n, $\s])), function1(bool())},
         {B64, insert_noise(B64, Wsps, InsertFn)}
     ).
 
@@ -326,7 +327,7 @@ non_b64_char(Mode) ->
 noisy_b64(Mode) ->
     ?LET(
         {{B64, WspedB64}, Noise, InsertFn},
-        {wsped_b64(Mode), non_empty(list(non_b64_char(Mode))), function1(boolean())},
+        {wsped_b64(Mode), non_empty(list(non_b64_char(Mode))), function1(bool())},
         {B64, insert_noise(WspedB64, Noise, InsertFn)}
     ).
 
diff --git a/lib/stdlib/test/property_test/ets_prop.erl b/lib/stdlib/test/property_test/ets_prop.erl
index cafaafe871..82721f6370 100644
--- a/lib/stdlib/test/property_test/ets_prop.erl
+++ b/lib/stdlib/test/property_test/ets_prop.erl
@@ -20,12 +20,15 @@
 %% %CopyrightEnd%
 %%
 -module(ets_prop).
+-compile([export_all, nowarn_export_all]).
 
 -include_lib("common_test/include/ct_property_test.hrl").
 
--type table_type() :: set | ordered_set | bag | duplicate_bag.
 
--define(ETS_TAB_DATA, proper_types:list({ct_proper_ext:safe_any(), ct_proper_ext:safe_any()})).
+-define(ETS_TAB_DATA, list({?CT_SAFE_ANY(), ?CT_SAFE_ANY()})).
+
+table_type() ->
+    oneof([set, ordered_set, bag, duplicate_bag]).
 
 %%%%%%%%%%%%%%%%%%
 %%% Properties %%%
diff --git a/lib/stdlib/test/property_test/gb_sets_prop.erl b/lib/stdlib/test/property_test/gb_sets_prop.erl
index e1a97aafe6..8abc0e0051 100644
--- a/lib/stdlib/test/property_test/gb_sets_prop.erl
+++ b/lib/stdlib/test/property_test/gb_sets_prop.erl
@@ -20,6 +20,7 @@
 %% %CopyrightEnd%
 %%
 -module(gb_sets_prop).
+-compile([export_all, nowarn_export_all]).
 
 -include_lib("common_test/include/ct_property_test.hrl").
 
@@ -37,8 +38,8 @@ prop_add() ->
         {S, L},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(),
-             non_empty(ct_proper_ext:safe_list())},
+            {?CT_SAFE_LIST(),
+             non_empty(?CT_SAFE_LIST())},
             {gb_sets:from_list(L1), L1 ++ L2}
         ),
         lists:all(fun(E) -> gb_sets:add(E, S) =:= gb_sets:add_element(E, S) end, L)
@@ -50,8 +51,8 @@ prop_balance() ->
         S,
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             lists:foldl(
                 fun gb_sets:del_element/2,
                 gb_sets:from_list(L1 ++ L2),
@@ -67,8 +68,8 @@ prop_ceiling() ->
         {S, O, L},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(),
-             non_empty(ct_proper_ext:safe_list())},
+            {?CT_SAFE_LIST(),
+             non_empty(?CT_SAFE_LIST())},
             {gb_sets:from_list(L1), lists:usort(L1), L1 ++ L2}
         ),
         lists:all(
@@ -92,8 +93,8 @@ prop_delete() ->
         {S, L},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(),
-             non_empty(ct_proper_ext:safe_list())},
+            {?CT_SAFE_LIST(),
+             non_empty(?CT_SAFE_LIST())},
             {gb_sets:from_list(L1), L1 ++ L2}
         ),
         lists:all(
@@ -120,8 +121,8 @@ prop_delete_any() ->
         {S, L},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(),
-             non_empty(ct_proper_ext:safe_list())},
+            {?CT_SAFE_LIST(),
+             non_empty(?CT_SAFE_LIST())},
             {gb_sets:from_list(L1), L1 ++ L2}
         ),
         lists:all(fun(E) -> gb_sets:delete_any(E, S) =:= gb_sets:del_element(E, S) end, L)
@@ -137,9 +138,9 @@ prop_difference() ->
         {S1, S2},
         ?LET(
             {L1, L2, Both},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {gb_sets:from_list(L1 ++ Both), gb_sets:from_list(L2 ++ Both)}
         ),
         gb_sets:difference(S1, S2) =:= gb_sets:subtract(S1, S2)
@@ -151,8 +152,8 @@ prop_floor() ->
         {S, O, L},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(),
-             non_empty(ct_proper_ext:safe_list())},
+            {?CT_SAFE_LIST(),
+             non_empty(?CT_SAFE_LIST())},
             {gb_sets:from_list(L1), lists:reverse(lists:usort(L1)), L1 ++ L2}
         ),
         lists:all(
@@ -174,7 +175,7 @@ do_floor(E, [X | R]) when X > E ->
 prop_from_ordset() ->
     ?FORALL(
         L,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         gb_sets:is_equal(gb_sets:from_list(L),
                          gb_sets:from_ordset(ordsets:from_list(L)))
     ).
@@ -185,8 +186,8 @@ prop_insert() ->
         {S, L},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(),
-             non_empty(ct_proper_ext:safe_list())},
+            {?CT_SAFE_LIST(),
+             non_empty(?CT_SAFE_LIST())},
             {gb_sets:from_list(L1), L1 ++ L2}
         ),
         lists:all(
@@ -213,8 +214,8 @@ prop_is_member() ->
         {S, L},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(),
-             non_empty(ct_proper_ext:safe_list())},
+            {?CT_SAFE_LIST(),
+             non_empty(?CT_SAFE_LIST())},
             {gb_sets:from_list(L1), L1 ++ L2}
         ),
         lists:all(fun(E) -> gb_sets:is_member(E, S) =:= gb_sets:is_element(E, S) end, L)
@@ -228,7 +229,7 @@ prop_iterator() ->
         {S, L},
         ?LET(
             L,
-            ct_proper_ext:safe_list(),
+            ?CT_SAFE_LIST(),
             begin
                 L1 = lists:usort(L),
                 {gb_sets:from_list(L1), L1}
@@ -240,7 +241,7 @@ prop_iterator() ->
         {S, L},
         ?LET(
             L,
-            ct_proper_ext:safe_list(),
+            ?CT_SAFE_LIST(),
             begin
                 L1 = lists:usort(L),
                 {gb_sets:from_list(L1), lists:reverse(L1)}
@@ -266,7 +267,7 @@ prop_iterator_from() ->
         {S, L, From},
         ?LET(
             {L, E},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_any()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_ANY()},
             begin
                 L1 = lists:usort(L),
                 L2 = lists:dropwhile(fun(X) -> X < E end, L1),
@@ -283,7 +284,7 @@ prop_iterator_from() ->
         {S, L, From},
         ?LET(
             {L, E},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_any()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_ANY()},
             begin
                 L1 = lists:usort(L),
                 L2 = lists:dropwhile(fun(X) -> X > E end, lists:reverse(L1)),
@@ -318,8 +319,8 @@ prop_larger() ->
         {S, O, L},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(),
-             non_empty(ct_proper_ext:safe_list())},
+            {?CT_SAFE_LIST(),
+             non_empty(?CT_SAFE_LIST())},
             {gb_sets:from_list(L1), lists:usort(L1), L1 ++ L2}
         ),
         lists:all(
@@ -343,7 +344,7 @@ prop_largest() ->
         {Set, Largest},
         ?LET(
             L,
-            non_empty(ct_proper_ext:safe_list()),
+            non_empty(?CT_SAFE_LIST()),
             begin
                 L1 = lists:usort(L),
                 {gb_sets:from_list(L1), lists:last(L1)}
@@ -356,7 +357,7 @@ prop_largest() ->
 prop_singleton() ->
     ?FORALL(
         E,
-        ct_proper_ext:safe_any(),
+        ?CT_SAFE_ANY(),
         [E] =:= gb_sets:to_list(gb_sets:singleton(E))
     ).
 
@@ -366,8 +367,8 @@ prop_smaller() ->
         {S, O, L},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(),
-             non_empty(ct_proper_ext:safe_list())},
+            {?CT_SAFE_LIST(),
+             non_empty(?CT_SAFE_LIST())},
             {gb_sets:from_list(L1), lists:reverse(lists:usort(L1)), L1 ++ L2}
         ),
         lists:all(
@@ -391,7 +392,7 @@ prop_smallest() ->
         {Set, Smallest},
         ?LET(
             L,
-            non_empty(ct_proper_ext:safe_list()),
+            non_empty(?CT_SAFE_LIST()),
             begin
                 L1 = lists:usort(L),
                 {gb_sets:from_list(L1), hd(L1)}
@@ -406,7 +407,7 @@ prop_take_largest() ->
         {S, Largest},
         ?LET(
             L,
-            non_empty(ct_proper_ext:safe_list()),
+            non_empty(?CT_SAFE_LIST()),
             begin
                 L1 = lists:usort(L),
                 {gb_sets:from_list(L1), lists:last(L1)}
@@ -425,7 +426,7 @@ prop_take_smallest() ->
         {S, Smallest},
         ?LET(
             L,
-            non_empty(ct_proper_ext:safe_list()),
+            non_empty(?CT_SAFE_LIST()),
             begin
                 L1 = lists:usort(L),
                 {gb_sets:from_list(L1), hd(L1)}
diff --git a/lib/stdlib/test/property_test/json_prop.erl b/lib/stdlib/test/property_test/json_prop.erl
index bafc4c23c3..b9ecd31fb4 100644
--- a/lib/stdlib/test/property_test/json_prop.erl
+++ b/lib/stdlib/test/property_test/json_prop.erl
@@ -20,6 +20,7 @@
 %% %CopyrightEnd%
 %%
 -module(json_prop).
+-compile([export_all, nowarn_export_all]).
 
 -include_lib("common_test/include/ct_property_test.hrl").
 
@@ -33,12 +34,12 @@ prop_string_roundtrip() ->
     end).
 
 prop_integer_roundtrip() ->
-    ?FORALL(Int, integer(), begin
+    ?FORALL(Int, int(), begin
         equals(Int, decode_io(json:encode(Int)))
     end).
 
 prop_float_roundtrip() ->
-    ?FORALL(Float, float(), begin
+    ?FORALL(Float, real(), begin
         equals(Float, decode_io(json:encode(Float)))
     end).
 
@@ -60,17 +61,17 @@ prop_escape_all() ->
 printable_string() ->
     Chars = oneof([
         oneof("\n\r\t\v\b\f\e\d"),
-        range(16#20, 16#7E),
-        range(16#A0, 16#D7FF),
-        range(16#E000, 16#FFFD),
-        range(16#10000, 16#10FFFF)
+        choose(16#20, 16#7E),
+        choose(16#A0, 16#D7FF),
+        choose(16#E000, 16#FFFD),
+        choose(16#10000, 16#10FFFF)
     ]),
     ?LET(L, list(Chars), unicode:characters_to_binary(L)).
 
 object() -> ?SIZED(Size, object(Size)).
 
 object(Size) ->
-    FlatTypes = oneof([integer(), float(), printable_string(), boolean(), null]),
+    FlatTypes = oneof([int(), real(), printable_string(), bool(), null]),
     case Size =:= 0 of
         true ->
             FlatTypes;
diff --git a/lib/stdlib/test/property_test/lists_prop.erl b/lib/stdlib/test/property_test/lists_prop.erl
index e6b74821d0..fd864413c8 100644
--- a/lib/stdlib/test/property_test/lists_prop.erl
+++ b/lib/stdlib/test/property_test/lists_prop.erl
@@ -20,6 +20,7 @@
 %% %CopyrightEnd%
 %%
 -module(lists_prop).
+-compile([export_all, nowarn_export_all]).
 
 -include_lib("common_test/include/ct_property_test.hrl").
 
@@ -31,7 +32,7 @@
 prop_all_true() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         lists:all(fun(_) -> true end, InList)
     ).
 
@@ -40,8 +41,8 @@ prop_all_false() ->
         {InList, Elem},
         ?LET(
             {F, R, E},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
              make_ref()},
             {F ++ [E|R], E}
         ),
@@ -54,8 +55,8 @@ prop_any_true() ->
         {InList, Elem},
         ?LET(
             {F, R, E},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
              make_ref()},
             {F ++ [E|R], E}
         ),
@@ -65,7 +66,7 @@ prop_any_true() ->
 prop_any_false() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         not lists:any(fun(_) -> false end, InList)
     ).
 
@@ -73,7 +74,7 @@ prop_any_false() ->
 prop_append_1() ->
     ?FORALL(
         InLists,
-        list(ct_proper_ext:safe_list()),
+        list(?CT_SAFE_LIST()),
         check_appended(InLists, lists:append(InLists))
     ).
 
@@ -81,7 +82,7 @@ prop_append_1() ->
 prop_append_2() ->
     ?FORALL(
         {InList1, InList2},
-        {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+        {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
         lists:append(InList1, InList2) =:= InList1 ++ InList2
     ).
 
@@ -90,7 +91,7 @@ prop_concat() ->
     ?FORALL(
         {InList, ExpString},
         gen_list_fold(
-            oneof([ct_proper_ext:safe_atom(), number(), string()]),
+            oneof([?CT_SAFE_ATOM(), oneof([int(), real()]), list(char())]),
             fun
                 (A, Acc) when is_atom(A) -> Acc ++ atom_to_list(A);
                 (I, Acc) when is_integer(I) -> Acc ++ integer_to_list(I);
@@ -108,9 +109,9 @@ prop_delete() ->
         {InList, DelElem},
         ?LET(
             {F, R, E},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_any()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_ANY()},
             {F ++ [E|R], E}
         ),
         begin
@@ -123,7 +124,7 @@ prop_delete() ->
 prop_delete_absent() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         lists:delete(make_ref(), InList) =:= InList
     ).
 
@@ -131,7 +132,7 @@ prop_delete_absent() ->
 prop_droplast() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         try
             lists:droplast(InList) =:= lists:reverse(tl(lists:reverse(InList)))
         catch
@@ -146,11 +147,11 @@ prop_dropwhile() ->
         {Pred, InList, ExpList},
         ?LET(
             Fn,
-            function1(boolean()),
+            function1(bool()),
             ?LET(
                 {L, {_, DL}},
                 gen_list_fold(
-                    ct_proper_ext:safe_any(),
+                    ?CT_SAFE_ANY(),
                     fun(E, {Drop, Acc}) ->
                         case Drop andalso Fn(E) of
                             true -> {true, Acc};
@@ -171,7 +172,7 @@ prop_duplicate() ->
         {N, Term, ExpList},
         ?LET(
             T,
-            ct_proper_ext:safe_any(),
+            ?CT_SAFE_ANY(),
             ?LET(L, list(T), {length(L), T, L})
         ),
         lists:duplicate(N, Term) =:= ExpList
@@ -184,7 +185,7 @@ prop_enumerate_1() ->
         ?LET(
             {L, {_, EL}},
             gen_list_fold(
-                ct_proper_ext:safe_any(),
+                ?CT_SAFE_ANY(),
                 fun(T, {I, Acc}) ->
                     {I + 1, Acc ++ [{I, T}]}
                 end,
@@ -201,11 +202,11 @@ prop_enumerate_2() ->
         {StartIndex, InList, ExpList},
         ?LET(
             N,
-            integer(),
+            int(),
             ?LET(
                 {L, {_, EL}},
                 gen_list_fold(
-                    ct_proper_ext:safe_any(),
+                    ?CT_SAFE_ANY(),
                     fun(T, {I, Acc}) ->
                         {I + 1, Acc ++ [{I, T}]}
                     end,
@@ -223,11 +224,11 @@ prop_enumerate_3() ->
         {StartIndex, Step, InList, ExpList},
         ?LET(
 	    {N, S},
-	    {integer(), integer()},
+	    {int(), int()},
             ?LET(
                 {L, {_, EL}},
                 gen_list_fold(
-                    ct_proper_ext:safe_any(),
+                    ?CT_SAFE_ANY(),
                     fun(T, {I, Acc}) ->
                         {I + S, Acc ++ [{I, T}]}
                     end,
@@ -245,11 +246,11 @@ prop_filter() ->
         {Pred, InList, ExpList},
         ?LET(
             P,
-            function1(boolean()),
+            function1(bool()),
             ?LET(
                 {L, F},
                 gen_list_fold(
-                    ct_proper_ext:safe_any(),
+                    ?CT_SAFE_ANY(),
                     fun(T, Acc) ->
                         case P(T) of
                             true -> Acc ++ [T];
@@ -270,11 +271,11 @@ prop_filtermap() ->
         {FilterMapFn, InList, ExpList},
         ?LET(
             Fn,
-            function1(oneof([true, false, {true, ct_proper_ext:safe_any()}])),
+            function1(oneof([true, false, {true, ?CT_SAFE_ANY()}])),
             ?LET(
                 {L, FM},
                 gen_list_fold(
-                    ct_proper_ext:safe_any(),
+                    ?CT_SAFE_ANY(),
                     fun(T, Acc) ->
                         case Fn(T) of
                             false -> Acc;
@@ -304,11 +305,11 @@ prop_flatmap() ->
         {MapFn, InList, ExpList},
         ?LET(
             Fn,
-            function1(ct_proper_ext:safe_list()),
+            function1(?CT_SAFE_LIST()),
             ?LET(
                 {L, FlatMapped},
                 gen_list_fold(
-                    ct_proper_ext:safe_any(),
+                    ?CT_SAFE_ANY(),
                     fun(T, Acc) ->
                         Acc ++ Fn(T)
                     end,
@@ -333,7 +334,7 @@ prop_flatten_2() ->
     ?FORALL(
         {{DeepList, FlatList}, Tail},
         {gen_list_deepfold(fun(_, E, Acc) -> Acc ++ [E] end, []),
-         ct_proper_ext:safe_list()},
+         ?CT_SAFE_LIST()},
         lists:flatten(DeepList, Tail) =:= FlatList ++ Tail
     ).
 
@@ -343,10 +344,10 @@ prop_foldl() ->
         {FoldFn, InList, Acc0, Exp},
         ?LET(
             {Fn, Acc0},
-            {function2(ct_proper_ext:safe_any()), ct_proper_ext:safe_any()},
+            {function2(?CT_SAFE_ANY()), ?CT_SAFE_ANY()},
             ?LET(
                 {L, V},
-                gen_list_fold(ct_proper_ext:safe_any(), Fn, Acc0),
+                gen_list_fold(?CT_SAFE_ANY(), Fn, Acc0),
                 {Fn, L, Acc0, V}
             )
         ),
@@ -359,10 +360,10 @@ prop_foldr() ->
         {FoldFn, InList, Acc0, Exp},
         ?LET(
             {Fn, Acc0},
-            {function2(ct_proper_ext:safe_any()), ct_proper_ext:safe_any()},
+            {function2(?CT_SAFE_ANY()), ?CT_SAFE_ANY()},
             ?LET(
                 {L, V},
-                gen_list_fold(ct_proper_ext:safe_any(), Fn, Acc0),
+                gen_list_fold(?CT_SAFE_ANY(), Fn, Acc0),
                 {Fn, lists:reverse(L), Acc0, V}
             )
         ),
@@ -373,7 +374,7 @@ prop_foldr() ->
 prop_foreach() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         begin
             Tag = make_ref(),
             lists:foreach(fun(E) -> self() ! {Tag, E} end, InList),
@@ -385,7 +386,7 @@ prop_foreach() ->
 prop_join() ->
     ?FORALL(
         {Sep, InList},
-        {ct_proper_ext:safe_any(), ct_proper_ext:safe_list()},
+        {?CT_SAFE_ANY(), ?CT_SAFE_LIST()},
         check_joined(Sep, InList, lists:join(Sep, InList))
     ).
 
@@ -395,11 +396,11 @@ prop_keydelete() ->
         {Key, N, InList},
         ?LET(
             {K, N},
-            {ct_proper_ext:safe_any(), range(1, 5)},
+            {?CT_SAFE_ANY(), choose(1, 5)},
             ?LET(
                 {F, R, E},
-                {ct_proper_ext:safe_list(),
-                 ct_proper_ext:safe_list(),
+                {?CT_SAFE_LIST(),
+                 ?CT_SAFE_LIST(),
                  gen_keytuple(K, N, N + 3)},
                 {K, N, F ++ [E|R]}
             )
@@ -413,10 +414,10 @@ prop_keydelete() ->
 
 prop_keydelete_absent() ->
     ?FORALL(
-        {N, InList},
-        {pos_integer(), ct_proper_ext:safe_list()},
-        lists:keydelete(make_ref(), N, InList) =:= InList
-    ).
+       {N, InList},
+       {?SUCHTHAT(X, int(), X > 0), ?CT_SAFE_LIST()},
+       lists:keydelete(make_ref(), N, InList) =:= InList
+      ).
 
 %% keyfind/3
 prop_keyfind() ->
@@ -424,11 +425,11 @@ prop_keyfind() ->
         {Key, N, InList},
         ?LET(
             {K, N},
-            {ct_proper_ext:safe_any(), range(1, 5)},
+            {?CT_SAFE_ANY(), choose(1, 5)},
             ?LET(
                 {F, R, E},
-                {ct_proper_ext:safe_list(),
-                 ct_proper_ext:safe_list(),
+                {?CT_SAFE_LIST(),
+                 ?CT_SAFE_LIST(),
                  gen_keytuple(K, N, N + 3)},
                 {K, N, F ++ [E|R]}
             )
@@ -444,7 +445,7 @@ prop_keyfind() ->
 prop_keyfind_absent() ->
     ?FORALL(
         {N, InList},
-        {pos_integer(), ct_proper_ext:safe_list()},
+        {?SUCHTHAT(X, int(), X > 0), ?CT_SAFE_LIST()},
         not lists:keyfind(make_ref(), N, InList)
     ).
 
@@ -454,10 +455,10 @@ prop_keymap() ->
         {MapFn, N, InList, ExpList},
         ?LET(
             Fn,
-            function([ct_proper_ext:safe_any()], ct_proper_ext:safe_any()),
+            function1(?CT_SAFE_ANY()),
             ?LET(
                 N,
-                range(1, 5),
+                choose(1, 5),
                 ?LET(
                     {L, M},
                     gen_list_fold(
@@ -480,11 +481,11 @@ prop_keymember() ->
         {Key, N, InList},
         ?LET(
             {K, N},
-            {ct_proper_ext:safe_any(), range(1, 5)},
+            {?CT_SAFE_ANY(), choose(1, 5)},
             ?LET(
                 {F, R, E},
-                {ct_proper_ext:safe_list(),
-                 ct_proper_ext:safe_list(),
+                {?CT_SAFE_LIST(),
+                 ?CT_SAFE_LIST(),
                  gen_keytuple(K, N, N + 3)},
                 {K, N, F ++ [E|R]}
             )
@@ -495,7 +496,7 @@ prop_keymember() ->
 prop_keymember_absent() ->
     ?FORALL(
         {N, InList},
-        {pos_integer(), ct_proper_ext:safe_list()},
+        {?SUCHTHAT(X, int(), X > 0), ?CT_SAFE_LIST()},
         not lists:keymember(make_ref(), N, InList)
     ).
 
@@ -505,7 +506,7 @@ prop_keymerge() ->
         {N, InList1, InList2},
         ?LET(
             N,
-            range(1, 5),
+            choose(1, 5),
             ?LET(
                 {L1, L2},
                 {list(gen_tuple(N, N+3)), list(gen_tuple(N, N+3))},
@@ -524,7 +525,7 @@ prop_keymerge_invalid() ->
         {N, InList, X, Y},
         ?LET(
             N,
-            range(1, 5),
+            choose(1, 5),
             ?LET(
                 {L, X, Y},
                 {list(gen_tuple(N, N+3)), non_list(), non_list()},
@@ -542,11 +543,11 @@ prop_keyreplace() ->
         {Key, N, InList, Replacement},
         ?LET(
             {K, N},
-            {ct_proper_ext:safe_any(), range(1, 5)},
+            {?CT_SAFE_ANY(), choose(1, 5)},
             ?LET(
                 {F, R, E0, E1},
-                {ct_proper_ext:safe_list(),
-                 ct_proper_ext:safe_list(),
+                {?CT_SAFE_LIST(),
+                 ?CT_SAFE_LIST(),
                  gen_keytuple(K, N, N + 3),
                  gen_tuple()},
                 {K, N, F ++ [E0|R], E1}
@@ -558,7 +559,7 @@ prop_keyreplace() ->
 prop_keyreplace_absent() ->
     ?FORALL(
         {N, InList, Replacement},
-        {pos_integer(), ct_proper_ext:safe_list(), gen_tuple()},
+        {?SUCHTHAT(X, int(), X > 0), ?CT_SAFE_LIST(), gen_tuple()},
         lists:keyreplace(make_ref(), N, InList, Replacement) =:= InList
     ).
 
@@ -568,11 +569,11 @@ prop_keysearch() ->
         {Key, N, InList},
         ?LET(
             {K, N},
-            {ct_proper_ext:safe_any(), range(1, 5)},
+            {?CT_SAFE_ANY(), choose(1, 5)},
             ?LET(
                 {F, R, E},
-                {ct_proper_ext:safe_list(),
-                 ct_proper_ext:safe_list(),
+                {?CT_SAFE_LIST(),
+                 ?CT_SAFE_LIST(),
                  gen_keytuple(K, N, N + 3)},
                 {K, N, F ++ [E|R]}
             )
@@ -588,7 +589,7 @@ prop_keysearch() ->
 prop_keysearch_absent() ->
     ?FORALL(
         {N, InList},
-        {pos_integer(), ct_proper_ext:safe_list()},
+        {?SUCHTHAT(X, int(), X > 0), ?CT_SAFE_LIST()},
         not lists:keysearch(make_ref(), N, InList)
     ).
 
@@ -598,7 +599,7 @@ prop_keysort() ->
         {N, InList},
         ?LET(
             N,
-            range(1, 5),
+            choose(1, 5),
             {N, list(gen_tuple(N, N + 3))}
         ),
         begin
@@ -614,11 +615,11 @@ prop_keystore() ->
         {Key, N, InList, ToStore},
         ?LET(
             {K, N},
-            {ct_proper_ext:safe_any(), range(1, 5)},
+            {?CT_SAFE_ANY(), choose(1, 5)},
             ?LET(
                 {F, R, E0, E1},
-                {ct_proper_ext:safe_list(),
-                 ct_proper_ext:safe_list(),
+                {?CT_SAFE_LIST(),
+                 ?CT_SAFE_LIST(),
                  gen_keytuple(K, N, N + 3),
                  gen_tuple()},
                 {K, N, F ++ [E0|R], E1}
@@ -630,7 +631,7 @@ prop_keystore() ->
 prop_keystore_absent() ->
     ?FORALL(
         {N, InList, ToStore},
-        {pos_integer(), ct_proper_ext:safe_list(), gen_tuple()},
+        {?SUCHTHAT(X, int(), X > 0), ?CT_SAFE_LIST(), gen_tuple()},
         lists:keystore(make_ref(), N, InList, ToStore) =:= InList ++ [ToStore]
     ).
 
@@ -640,11 +641,11 @@ prop_keytake() ->
         {Key, N, InList, ExpList, ExpElem},
         ?LET(
            {K, N},
-           {make_ref(), range(1, 5)},
+           {make_ref(), choose(1, 5)},
            ?LET(
                {F, R, E},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
              gen_keytuple(K, N, N + 3)},
             {K, N, F ++ [E|R], F ++ R, E}
            )
@@ -655,7 +656,7 @@ prop_keytake() ->
 prop_keytake_absent() ->
     ?FORALL(
         {N, InList},
-        {pos_integer(), ct_proper_ext:safe_list()},
+        {?SUCHTHAT(X, int(), X > 0), ?CT_SAFE_LIST()},
         lists:keytake(make_ref(), N, InList) =:= false
     ).
 
@@ -663,7 +664,7 @@ prop_keytake_absent() ->
 prop_last() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         try
             lists:last(InList) =:= hd(lists:reverse(InList))
         catch
@@ -678,11 +679,11 @@ prop_map() ->
         {MapFn, InList, ExpList},
         ?LET(
             Fn,
-            function1(ct_proper_ext:safe_any()),
+            function1(?CT_SAFE_ANY()),
             ?LET(
                 {L, M},
                 gen_list_fold(
-                    ct_proper_ext:safe_any(),
+                    ?CT_SAFE_ANY(),
                     fun(T, Acc) ->
                         Acc ++ [Fn(T)]
                     end,
@@ -700,13 +701,13 @@ prop_mapfoldl() ->
         {MapFoldFn, InList, Acc0, Exp},
         ?LET(
             {MapFn, FoldFn, Acc0},
-            {function1(ct_proper_ext:safe_any()),
-             function2(ct_proper_ext:safe_any()),
-             ct_proper_ext:safe_any()},
+            {function1(?CT_SAFE_ANY()),
+             function2(?CT_SAFE_ANY()),
+             ?CT_SAFE_ANY()},
             ?LET(
                 {L, MV},
                 gen_list_fold(
-                    ct_proper_ext:safe_any(),
+                    ?CT_SAFE_ANY(),
                     fun(T, {AccM, AccF}) ->
                         {AccM ++ [MapFn(T)], FoldFn(T, AccF)}
                     end,
@@ -724,13 +725,13 @@ prop_mapfoldr() ->
         {MapFoldFn, InList, Acc0, Exp},
         ?LET(
             {MapFn, FoldFn, Acc0},
-            {function1(ct_proper_ext:safe_any()),
-             function2(ct_proper_ext:safe_any()),
-             ct_proper_ext:safe_any()},
+            {function1(?CT_SAFE_ANY()),
+             function2(?CT_SAFE_ANY()),
+             ?CT_SAFE_ANY()},
             ?LET(
                 {L, MV},
                 gen_list_fold(
-                    ct_proper_ext:safe_any(),
+                    ?CT_SAFE_ANY(),
                     fun(T, {AccM, AccF}) ->
                         {[MapFn(T)|AccM], FoldFn(T, AccF)}
                     end,
@@ -746,7 +747,7 @@ prop_mapfoldr() ->
 prop_max() ->
     ?FORALL(
         {InList, ExpMax},
-        gen_list_fold(ct_proper_ext:safe_any(), fun erlang:max/2),
+        gen_list_fold(?CT_SAFE_ANY(), fun erlang:max/2),
         try
             lists:max(InList) == ExpMax
         catch
@@ -761,9 +762,9 @@ prop_member() ->
         {InList, Member},
         ?LET(
             {F, R, E},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_any()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_ANY()},
             {F ++ [E|R], E}
         ),
         lists:member(Member, InList)
@@ -772,7 +773,7 @@ prop_member() ->
 prop_member_absent() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         not lists:member(make_ref(), InList)
     ).
 
@@ -780,7 +781,7 @@ prop_member_absent() ->
 prop_merge_1() ->
     ?FORALL(
         InLists,
-        list(?LET(L, ct_proper_ext:safe_list(), lists:sort(L))),
+        list(?LET(L, ?CT_SAFE_LIST(), lists:sort(L))),
         check_merged(fun erlang:'=<'/2, InLists, lists:merge(InLists))
     ).
 
@@ -789,9 +790,9 @@ prop_merge_1_invalid() ->
         InLists,
         ?LET(
             {L1, X, L2},
-            {list(oneof([non_list(), ct_proper_ext:safe_list()])),
+            {list(oneof([non_list(), ?CT_SAFE_LIST()])),
              non_list(),
-             list(oneof([non_list(), ct_proper_ext:safe_list()]))},
+             list(oneof([non_list(), ?CT_SAFE_LIST()]))},
             L1 ++ [X|L2]
         ),
         expect_error(fun lists:merge/1, [InLists])
@@ -803,7 +804,7 @@ prop_merge_2() ->
         {InList1, InList2},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
             {lists:sort(L1), lists:sort(L2)}
         ),
         check_merged(fun erlang:'=<'/2, [InList1, InList2], lists:merge(InList1, InList2))
@@ -812,7 +813,7 @@ prop_merge_2() ->
 prop_merge_2_invalid() ->
     ?FORALL(
         {InList, X, Y},
-        {ct_proper_ext:safe_list(), non_list(), non_list()},
+        {?CT_SAFE_LIST(), non_list(), non_list()},
         expect_error(fun lists:merge/2, [InList, X]) andalso
         expect_error(fun lists:merge/2, [X, InList]) andalso
         expect_error(fun lists:merge/2, [X, Y])
@@ -825,8 +826,8 @@ prop_merge_3() ->
         ?LET(
             {Fn, L1, L2},
             {gen_ordering_fun(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {Fn, lists:sort(Fn, L1), lists:sort(Fn, L2)}
         ),
         check_merged(SortFn, [InList1, InList2], lists:merge(SortFn, InList1, InList2))
@@ -836,7 +837,7 @@ prop_merge_3_invalid() ->
     ?FORALL(
         {SortFn, InList, X, Y},
         {gen_ordering_fun(),
-         ct_proper_ext:safe_list(),
+         ?CT_SAFE_LIST(),
          non_list(),
          non_list()},
         expect_error(fun lists:merge/3, [SortFn, InList, Y]) andalso
@@ -850,9 +851,9 @@ prop_merge3() ->
         {InList1, InList2, InList3},
         ?LET(
             {L1, L2, L3},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {lists:sort(L1), lists:sort(L2), lists:sort(L3)}
         ),
         check_merged(fun erlang:'=<'/2, [InList1, InList2, InList3], lists:merge3(InList1, InList2, InList3))
@@ -861,7 +862,7 @@ prop_merge3() ->
 prop_merge3_invalid() ->
     ?FORALL(
         {InList, X, Y, Z},
-        {ct_proper_ext:safe_list(), non_list(), non_list(), non_list()},
+        {?CT_SAFE_LIST(), non_list(), non_list(), non_list()},
         expect_error(fun lists:merge/3, [InList, InList, Z]) andalso
         expect_error(fun lists:merge/3, [InList, Y, InList]) andalso
         expect_error(fun lists:merge/3, [InList, Y, Z]) andalso
@@ -874,7 +875,7 @@ prop_merge3_invalid() ->
 prop_min() ->
     ?FORALL(
         {InList, ExpMin},
-        gen_list_fold(ct_proper_ext:safe_any(), fun erlang:min/2),
+        gen_list_fold(?CT_SAFE_ANY(), fun erlang:min/2),
         try
             lists:min(InList) == ExpMin
         catch
@@ -889,9 +890,9 @@ prop_nth() ->
         {InList, N, ExpElem},
         ?LET(
             {F, R, E},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_any()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_ANY()},
             {F ++ [E|R], length(F)+1, E}
         ),
         lists:nth(N, InList) =:= ExpElem
@@ -902,7 +903,7 @@ prop_nth_outofrange() ->
         {N, InList},
         ?LET(
             {L, Offset},
-            {ct_proper_ext:safe_list(), pos_integer()},
+            {?CT_SAFE_LIST(), ?SUCHTHAT(X, int(), X > 0)},
             {length(L) + Offset, L}
         ),
         try
@@ -922,7 +923,7 @@ prop_nthtail() ->
         {InList, N, ExpTail},
         ?LET(
             {F, R},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
             {F ++ R, length(F), R}
         ),
         lists:nthtail(N, InList) =:= ExpTail
@@ -933,7 +934,7 @@ prop_nthtail_outofrange() ->
         {N, InList},
         ?LET(
             {L, Offset},
-            {ct_proper_ext:safe_list(), pos_integer()},
+            {?CT_SAFE_LIST(), ?SUCHTHAT(X, int(), X > 0)},
             {length(L) + Offset, L}
         ),
         try
@@ -951,7 +952,7 @@ prop_nthtail_outofrange() ->
 prop_partition() ->
     ?FORALL(
         {Pred, InList},
-        {function1(boolean()), ct_proper_ext:safe_list()},
+        {function1(bool()), ?CT_SAFE_LIST()},
         begin
             {Group1, Group2} = lists:partition(Pred, InList),
             check_partitioned(Pred, InList, Group1, Group2)
@@ -964,7 +965,7 @@ prop_prefix() ->
         {InList, Prefix},
         ?LET(
             {F, R},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
             {F ++ R, F}
         ),
         lists:prefix(Prefix, InList) andalso
@@ -977,7 +978,7 @@ prop_prefix() ->
 prop_reverse_1() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         check_reversed(InList, lists:reverse(InList)) andalso
         lists:reverse(lists:reverse(InList)) =:= InList
     ).
@@ -986,7 +987,7 @@ prop_reverse_1() ->
 prop_reverse_2() ->
     ?FORALL(
         {InList, InTail},
-        {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+        {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
         check_reversed(InList, lists:reverse(InList, InTail), InTail)
     ).
 
@@ -996,8 +997,8 @@ prop_search() ->
         {Pred, InList, ExpElem},
         ?LET(
             {F, R, E},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
              make_ref()},
             {fun(T) -> T =:= E end, F ++ [E|R], E}
         ),
@@ -1007,7 +1008,7 @@ prop_search() ->
 prop_search_absent() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         lists:search(fun(_) -> false end, InList) =:= false
     ).
 
@@ -1015,7 +1016,7 @@ prop_search_absent() ->
 prop_seq2() ->
     ?FORALL(
         {From, To},
-        {integer(), integer()},
+        {int(), int()},
         try
             lists:seq(From, To)
         of
@@ -1032,7 +1033,7 @@ prop_seq2() ->
 prop_seq3() ->
     ?FORALL(
         {From, To, Step},
-        {integer(), integer(), integer()},
+        {int(), int(), int()},
         try
             lists:seq(From, To, Step)
         of
@@ -1059,7 +1060,7 @@ prop_seq3() ->
 prop_sort_1() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         begin
             Sorted = lists:sort(InList),
             length(Sorted) =:= length(InList) andalso
@@ -1071,7 +1072,7 @@ prop_sort_1() ->
 prop_sort_2() ->
     ?FORALL(
         {SortFn, InList},
-        {gen_ordering_fun(), ct_proper_ext:safe_list()},
+        {gen_ordering_fun(), ?CT_SAFE_LIST()},
         begin
             Sorted = lists:sort(SortFn, InList),
             length(Sorted) =:= length(InList) andalso
@@ -1085,7 +1086,7 @@ prop_split() ->
         {N, InList, ExpList1, ExpList2},
         ?LET(
             {F, R},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
             {length(F), F ++ R, F, R}
         ),
         lists:split(N, InList) =:= {ExpList1, ExpList2}
@@ -1096,7 +1097,7 @@ prop_split_outofrange() ->
         {N, InList},
         ?LET(
             {L, Offset},
-            {ct_proper_ext:safe_list(), pos_integer()},
+            {?CT_SAFE_LIST(), ?SUCHTHAT(X, int(), X > 0)},
             {length(L) + Offset, L}
         ),
         try
@@ -1114,7 +1115,7 @@ prop_split_outofrange() ->
 prop_splitwith() ->
     ?FORALL(
         {Pred, InList},
-        {function1(boolean()), ct_proper_ext:safe_list()},
+        {function1(bool()), ?CT_SAFE_LIST()},
         begin
             {Part1, Part2} = lists:splitwith(Pred, InList),
             check_splitwithed(Pred, InList, Part1, Part2)
@@ -1127,7 +1128,7 @@ prop_sublist_2() ->
         {Len, InList, ExpList},
         ?LET(
             {F, R},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
             {length(F), F ++ R, F}
         ),
         lists:sublist(InList, Len) =:= ExpList
@@ -1139,9 +1140,9 @@ prop_sublist_3() ->
         {Start, Len, InList, ExpList},
         ?LET(
             {F, M, R},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {length(F)+1, length(M), F ++ M ++ R, M}
         ),
         lists:sublist(InList, Start, Len) =:= ExpList
@@ -1153,9 +1154,9 @@ prop_subtract() ->
         {InList, SubtractList},
         ?LET(
             {L, B, S},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {L ++ B, S ++ B}
         ),
         lists:subtract(InList, SubtractList) =:= InList -- SubtractList
@@ -1167,7 +1168,7 @@ prop_suffix() ->
         {InList, Suffix},
         ?LET(
             {F, R},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
             {F ++ R, R}
         ),
         lists:suffix(Suffix, InList) andalso
@@ -1180,7 +1181,7 @@ prop_suffix() ->
 prop_sum() ->
     ?FORALL(
         {InList, ExpSum},
-        gen_list_fold(number(), fun erlang:'+'/2, 0),
+        gen_list_fold(oneof([int(), real()]), fun erlang:'+'/2, 0),
         lists:sum(InList) =:= ExpSum
     ).
 
@@ -1190,11 +1191,11 @@ prop_takewhile() ->
         {Pred, InList, ExpList},
         ?LET(
             Fn,
-            function1(boolean()),
+            function1(bool()),
             ?LET(
                 {L, {_, TL}},
                 gen_list_fold(
-                    ct_proper_ext:safe_any(),
+                    ?CT_SAFE_ANY(),
                     fun(E, {Take, Acc}) ->
                         case Take andalso Fn(E) of
                             true -> {true, Acc ++ [E]};
@@ -1215,7 +1216,7 @@ prop_ukeymerge() ->
         {N, InList1, InList2},
         ?LET(
             N,
-            range(1, 5),
+            choose(1, 5),
             ?LET(
                 {L1, L2},
                 {list(gen_tuple(N, N+3)), list(gen_tuple(N, N+3))},
@@ -1234,7 +1235,7 @@ prop_ukeymerge_invalid() ->
         {N, InList, X, Y},
         ?LET(
             N,
-            range(1, 5),
+            choose(1, 5),
             ?LET(
                 {L, X, Y},
                 {list(gen_tuple(N, N+3)), non_list(), non_list()},
@@ -1252,7 +1253,7 @@ prop_ukeysort() ->
         {N, InList},
         ?LET(
             N,
-            range(1, 5),
+            choose(1, 5),
             {N, list(gen_tuple(N, N + 3))}
         ),
         begin
@@ -1266,7 +1267,7 @@ prop_ukeysort() ->
 prop_umerge_1() ->
     ?FORALL(
         InLists,
-        list(?LET(L, ct_proper_ext:safe_list(), lists:usort(L))),
+        list(?LET(L, ?CT_SAFE_LIST(), lists:usort(L))),
         check_umerged(InLists, lists:umerge(InLists))
     ).
 
@@ -1275,9 +1276,9 @@ prop_umerge_1_invalid() ->
         InList,
         ?LET(
             {L1, X, L2},
-	    {list(oneof([non_list(), ct_proper_ext:safe_list()])),
+	    {list(oneof([non_list(), ?CT_SAFE_LIST()])),
              non_list(),
-             list(oneof([non_list(), ct_proper_ext:safe_list()]))},
+             list(oneof([non_list(), ?CT_SAFE_LIST()]))},
 	    L1 ++ [X|L2]
         ),
 	expect_error(fun lists:umerge/1, [InList])
@@ -1289,7 +1290,7 @@ prop_umerge_2() ->
         {InList1, InList2},
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
             {lists:usort(L1), lists:usort(L2)}
         ),
         check_umerged([InList1, InList2], lists:umerge(InList1, InList2))
@@ -1298,7 +1299,7 @@ prop_umerge_2() ->
 prop_umerge_2_invalid() ->
     ?FORALL(
         {InList, X, Y},
-	{ct_proper_ext:safe_list(), non_list(), non_list()},
+	{?CT_SAFE_LIST(), non_list(), non_list()},
 	expect_error(fun lists:umerge/2, [InList, Y]) andalso
 	expect_error(fun lists:umerge/2, [X, InList]) andalso
 	expect_error(fun lists:umerge/2, [X, Y])
@@ -1311,8 +1312,8 @@ prop_umerge_3() ->
         ?LET(
             {Fn, L1, L2},
             {gen_ordering_fun(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {Fn, lists:usort(Fn, L1), lists:usort(Fn, L2)}
         ),
         check_umerged(SortFn, [InList1, InList2], lists:umerge(SortFn, InList1, InList2))
@@ -1322,7 +1323,7 @@ prop_umerge_3_invalid() ->
     ?FORALL(
         {SortFn, InList, X, Y},
 	{gen_ordering_fun(),
-         ct_proper_ext:safe_list(),
+         ?CT_SAFE_LIST(),
          non_list(),
          non_list()},
 	expect_error(fun lists:umerge/3, [SortFn, InList, Y]) andalso
@@ -1336,9 +1337,9 @@ prop_umerge3() ->
         {InList1, InList2, InList3},
         ?LET(
             {L1, L2, L3},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {lists:usort(L1), lists:usort(L2), lists:usort(L3)}
         ),
         check_umerged([InList1, InList2, InList3], lists:umerge3(InList1, InList2, InList3))
@@ -1347,7 +1348,7 @@ prop_umerge3() ->
 prop_umerge3_invalid() ->
     ?FORALL(
         {InList, X, Y, Z},
-	{ct_proper_ext:safe_list(), non_list(), non_list(), non_list()},
+	{?CT_SAFE_LIST(), non_list(), non_list(), non_list()},
 	expect_error(fun lists:umerge3/3, [InList, InList, Z]) andalso
 	expect_error(fun lists:umerge3/3, [InList, Y, InList]) andalso
 	expect_error(fun lists:umerge3/3, [InList, Y, Z]) andalso
@@ -1363,10 +1364,10 @@ prop_uniq_1() ->
         InList,
         ?LET(
             {L, M},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
 	    ?LET(
 	        S,
-		vector(length(L) + 2 * length(M), integer()),
+		vector(length(L) + 2 * length(M), int()),
 	        [E || {_, E} <- lists:sort(lists:zip(S, L ++ M ++ M))]
 	    )
         ),
@@ -1377,7 +1378,7 @@ prop_uniq_1() ->
 prop_uniq_2() ->
     ?FORALL(
         {UniqFn, InList},
-        {function1(oneof([a, b, c])), ct_proper_ext:safe_list()},
+        {function1(oneof([a, b, c])), ?CT_SAFE_LIST()},
         check_uniqed(UniqFn, InList, lists:uniq(UniqFn, InList))
     ).
 
@@ -1386,7 +1387,7 @@ prop_unzip() ->
     ?FORALL(
         {InList, {ExpList1, ExpList2}},
         gen_list_fold(
-            {ct_proper_ext:safe_any(), ct_proper_ext:safe_any()},
+            {?CT_SAFE_ANY(), ?CT_SAFE_ANY()},
             fun({T1, T2}, {L1, L2}) ->
                 {L1 ++ [T1], L2 ++ [T2]}
             end,
@@ -1400,9 +1401,9 @@ prop_unzip3() ->
     ?FORALL(
         {InList, {ExpList1, ExpList2, ExpList3}},
         gen_list_fold(
-            {ct_proper_ext:safe_any(),
-             ct_proper_ext:safe_any(),
-             ct_proper_ext:safe_any()},
+            {?CT_SAFE_ANY(),
+             ?CT_SAFE_ANY(),
+             ?CT_SAFE_ANY()},
             fun({T1, T2, T3}, {L1, L2, L3}) ->
                 {L1 ++ [T1], L2 ++ [T2], L3 ++ [T3]}
             end,
@@ -1415,7 +1416,7 @@ prop_unzip3() ->
 prop_usort_1() ->
     ?FORALL(
         InList,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         begin
             Sorted = lists:usort(InList),
             length(Sorted) =< length(InList) andalso
@@ -1427,7 +1428,7 @@ prop_usort_1() ->
 prop_usort_2() ->
     ?FORALL(
         {SortFn, InList},
-        {gen_ordering_fun(), ct_proper_ext:safe_list()},
+        {gen_ordering_fun(), ?CT_SAFE_LIST()},
         begin
             Sorted = lists:usort(SortFn, InList),
             length(Sorted) =< length(InList) andalso
@@ -1440,7 +1441,7 @@ prop_zip_2() ->
     ?FORALL(
         {ExpList, {InList1, InList2}},
         gen_list_fold(
-            {ct_proper_ext:safe_any(), ct_proper_ext:safe_any()},
+            {?CT_SAFE_ANY(), ?CT_SAFE_ANY()},
             fun({T1, T2}, {L1, L2}) ->
                 {L1 ++ [T1], L2 ++ [T2]}
             end,
@@ -1455,13 +1456,13 @@ prop_zip_3() ->
 		{{ExpList, {InList1, InList2}}, ExtraList},
 		{
 			gen_list_fold(
-				{ct_proper_ext:safe_any(), ct_proper_ext:safe_any()},
+				{?CT_SAFE_ANY(), ?CT_SAFE_ANY()},
 				fun({T1, T2}, {L1, L2}) ->
 					{L1 ++ [T1], L2 ++ [T2]}
 				end,
 				{[], []}
 			),
-			non_empty(ct_proper_ext:safe_list())
+			non_empty(?CT_SAFE_LIST())
 		},
 		begin
 			Tag = make_ref(),
@@ -1490,9 +1491,9 @@ prop_zip3_3() ->
     ?FORALL(
         {ExpList, {InList1, InList2, InList3}},
         gen_list_fold(
-            {ct_proper_ext:safe_any(),
-             ct_proper_ext:safe_any(),
-             ct_proper_ext:safe_any()},
+            {?CT_SAFE_ANY(),
+             ?CT_SAFE_ANY(),
+             ?CT_SAFE_ANY()},
             fun({T1, T2, T3}, {L1, L2, L3}) ->
                 {L1 ++ [T1], L2 ++ [T2], L3 ++ [T3]}
             end,
@@ -1507,15 +1508,15 @@ prop_zip3_4() ->
 		{{ExpList, {InList1, InList2, InList3}}, ExtraList},
 		{
 			gen_list_fold(
-				{ct_proper_ext:safe_any(),
-				 ct_proper_ext:safe_any(),
-				 ct_proper_ext:safe_any()},
+				{?CT_SAFE_ANY(),
+				 ?CT_SAFE_ANY(),
+				 ?CT_SAFE_ANY()},
 				fun({T1, T2, T3}, {L1, L2, L3}) ->
 					{L1 ++ [T1], L2 ++ [T2], L3 ++ [T3]}
 				end,
 				{[], [], []}
 			),
-			non_empty(ct_proper_ext:safe_list())
+			non_empty(?CT_SAFE_LIST())
 		},
 		begin
 			Tag = make_ref(),
@@ -1561,11 +1562,11 @@ prop_zipwith_3() ->
         {ZipFn, InList1, InList2, ExpList},
         ?LET(
             Fn,
-            function2(ct_proper_ext:safe_any()),
+            function2(?CT_SAFE_ANY()),
             ?LET(
                 {_, {L1, L2, Z}},
                 gen_list_fold(
-                    {ct_proper_ext:safe_any(), ct_proper_ext:safe_any()},
+                    {?CT_SAFE_ANY(), ?CT_SAFE_ANY()},
                     fun({T1, T2}, {L1, L2, Z}) ->
                         {L1 ++ [T1], L2 ++ [T2], Z ++ [Fn(T1, T2)]}
                     end,
@@ -1583,12 +1584,12 @@ prop_zipwith_4() ->
 		{ZipFn, InList1, InList2, ExpList, ExtraList},
 		?LET(
 			{Extra, Fn},
-			{non_empty(ct_proper_ext:safe_list()),
-			 function2(ct_proper_ext:safe_any())},
+			{non_empty(?CT_SAFE_LIST()),
+			 function2(?CT_SAFE_ANY())},
 			?LET(
 				{_, {L1, L2, Z}},
 				gen_list_fold(
-					{ct_proper_ext:safe_any(), ct_proper_ext:safe_any()},
+					{?CT_SAFE_ANY(), ?CT_SAFE_ANY()},
 					fun({T1, T2}, {L1, L2, Z}) ->
 						{L1 ++ [T1], L2 ++ [T2], Z ++ [Fn(T1, T2)]}
 					end,
@@ -1625,13 +1626,13 @@ prop_zipwith3_4() ->
         {ZipFn, InList1, InList2, InList3, ExpList},
         ?LET(
             Fn,
-            function3(ct_proper_ext:safe_any()),
+            function3(?CT_SAFE_ANY()),
             ?LET(
                 {_, {L1, L2, L3, Z}},
                 gen_list_fold(
-                    {ct_proper_ext:safe_any(),
-                     ct_proper_ext:safe_any(),
-                     ct_proper_ext:safe_any()},
+                    {?CT_SAFE_ANY(),
+                     ?CT_SAFE_ANY(),
+                     ?CT_SAFE_ANY()},
                     fun({T1, T2, T3}, {L1, L2, L3, Z}) ->
                         {L1 ++ [T1], L2 ++ [T2], L3 ++ [T3], Z ++ [Fn(T1, T2, T3)]}
                     end,
@@ -1649,14 +1650,14 @@ prop_zipwith3_5() ->
 		{ZipFn, InList1, InList2, InList3, ExpList, ExtraList},
 		?LET(
 			{Extra, Fn},
-			{non_empty(ct_proper_ext:safe_list()),
-			 function3(ct_proper_ext:safe_any())},
+			{non_empty(?CT_SAFE_LIST()),
+			 function3(?CT_SAFE_ANY())},
 			?LET(
 				{_, {L1, L2, L3, Z}},
 				gen_list_fold(
-					{ct_proper_ext:safe_any(),
-					 ct_proper_ext:safe_any(),
-					 ct_proper_ext:safe_any()},
+					{?CT_SAFE_ANY(),
+					 ?CT_SAFE_ANY(),
+					 ?CT_SAFE_ANY()},
 					fun({T1, T2, T3}, {L1, L2, L3, Z}) ->
 						{L1 ++ [T1], L2 ++ [T2], L3 ++ [T3], Z ++ [Fn(T1, T2, T3)]}
 					end,
@@ -1708,7 +1709,7 @@ prop_zipwith3_5() ->
 %%%%%%%%%%%%%%%%%%
 
 non_list() ->
-    ?SUCHTHAT(NonList, ct_proper_ext:safe_any(), not is_list(NonList)).
+    ?SUCHTHAT(NonList, ?CT_SAFE_ANY(), not is_list(NonList)).
 
 %% Generator for lists of the given type, folding the given function
 %% over values on the top level as they are generated. The first generated
@@ -1761,13 +1762,13 @@ gen_keytuple(Key, MinSize, MaxSize) ->
 
 %% Generator for tuples of random size.
 gen_tuple() ->
-    ct_proper_ext:safe_tuple().
+    ?CT_SAFE_TUPLE().
 
 %% Generator for tuples of the given size.
 gen_tuple(Size) ->
     ?LET(
         V,
-        vector(Size, ct_proper_ext:safe_any()),
+        vector(Size, ?CT_SAFE_ANY()),
         list_to_tuple(V)
     ).
 
@@ -1776,10 +1777,10 @@ gen_tuple(Size) ->
 gen_tuple(MinSize, MaxSize) ->
     ?LET(
         N,
-        range(MinSize, MaxSize),
+        choose(MinSize, MaxSize),
         ?LET(
             V,
-            vector(N, ct_proper_ext:safe_any()),
+            vector(N, ?CT_SAFE_ANY()),
             list_to_tuple(V)
         )
     ).
@@ -1802,10 +1803,10 @@ gen_list_deepfold(N, Level, L, FoldFn, Acc) ->
     ?LET(
         X,
         frequency([
-            {5, {term, oneof([ct_proper_ext:safe_atom(),
-                              ct_proper_ext:safe_tuple(),
-                              integer(),
-                              float(),
+            {5, {term, oneof([?CT_SAFE_ATOM(),
+                              ?CT_SAFE_TUPLE(),
+                              int(),
+                              real(),
                               bitstring()])}},
             {1, deeplist},
             {2, stop}
@@ -1832,7 +1833,7 @@ gen_list_deepfold(N, Level, L, FoldFn, Acc) ->
 gen_ordering_fun() ->
     ?LET(
         F,
-        function1(range(1, 3)),
+        function1(choose(1, 3)),
         fun(T1, T2) ->
             F(T1) =< F(T2)
         end
diff --git a/lib/stdlib/test/property_test/queue_prop.erl b/lib/stdlib/test/property_test/queue_prop.erl
index e7d029f349..9b320f610f 100644
--- a/lib/stdlib/test/property_test/queue_prop.erl
+++ b/lib/stdlib/test/property_test/queue_prop.erl
@@ -20,6 +20,7 @@
 %% %CopyrightEnd%
 %%
 -module(queue_prop).
+-compile([export_all, nowarn_export_all]).
 
 -include_lib("common_test/include/ct_property_test.hrl").
 
@@ -45,7 +46,7 @@ prop_is_queue() ->
 prop_list_conversion() ->
     ?FORALL(
         List,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         begin
             Queue = queue:from_list(List),
             queue:is_queue(Queue) andalso
@@ -56,7 +57,7 @@ prop_list_conversion() ->
 prop_from_list_invalid() ->
     ?FORALL(
         NonList,
-        ?SUCHTHAT(T, ct_proper_ext:safe_any(), not is_list(T)),
+        ?SUCHTHAT(T, ?CT_SAFE_ANY(), not is_list(T)),
         expect_badarg(fun queue:from_list/1, [NonList])
     ).
 
@@ -66,8 +67,8 @@ prop_to_list_invalid() ->
 prop_all() ->
     ?FORALL(
         {L, Q},
-        oneof([list_queue(ct_proper_ext:safe_atom()),
-               list_queue(ct_proper_ext:safe_any())]),
+        oneof([list_queue(?CT_SAFE_ATOM()),
+               list_queue(?CT_SAFE_ANY())]),
         begin
             lists:all(fun is_atom/1, L) =:= queue:all(fun is_atom/1, Q)
         end
@@ -103,7 +104,7 @@ prop_daeh_invalid() ->
 prop_delete() ->
     ?FORALL(
         {X, {L, Q}},
-        {ct_proper_ext:safe_any(), list_queue()},
+        {?CT_SAFE_ANY(), list_queue()},
         begin
             R1 = if
                 L =:= [] ->
@@ -124,7 +125,7 @@ prop_delete_invalid() ->
 prop_delete_r() ->
     ?FORALL(
         {X, {L, Q}},
-        {ct_proper_ext:safe_any(), list_queue()},
+        {?CT_SAFE_ANY(), list_queue()},
         begin
             R1 = if
                 L =:= [] ->
@@ -301,7 +302,7 @@ prop_head_invalid() ->
 prop_in() ->
     ?FORALL(
         L,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         begin
             Q = lists:foldl(
                 fun(I, Acc) ->
@@ -384,7 +385,7 @@ prop_liat_invalid() ->
 prop_member() ->
     ?FORALL(
         {X, {L, Q}},
-        {ct_proper_ext:safe_any(), list_queue()},
+        {?CT_SAFE_ANY(), list_queue()},
         begin
             % all members of L are members of Q
             lists:all(
@@ -500,7 +501,7 @@ prop_reverse_invalid() ->
 prop_snoc() ->
     ?FORALL(
         L,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         begin
             Q = lists:foldl(
                 fun(I, Acc) ->
@@ -516,14 +517,14 @@ prop_snoc() ->
 prop_snoc_invalid() ->
     ?FORALL(
         {I, NonQueue},
-        {ct_proper_ext:safe_any(), non_queue()},
+        {?CT_SAFE_ANY(), non_queue()},
         expect_badarg(fun queue:snoc/2, [NonQueue, I])
     ).
 
 prop_split() ->
     ?FORALL(
         {N, {L, Q}},
-        {non_neg_integer(), list_queue()},
+        {nat(), list_queue()},
         begin
             N1 = N rem (length(L) + 1),
             {Q1, Q2} = queue:split(N1, Q),
@@ -542,7 +543,7 @@ prop_split_invalid() ->
                 {non_queue(), 0},
                 ?SUCHTHAT(
                     {Q1, N1},
-                    {queue(), ct_proper_ext:safe_any()},
+                    {queue(), ?CT_SAFE_ANY()},
                     not(is_integer(N1) andalso N1>=0 andalso N1=<queue:len(Q1))
                 )
             ]
@@ -562,15 +563,15 @@ prop_ops() ->
         {Ops, {L, Q}},
         {
             list(
-                oneof([{cons, ct_proper_ext:safe_any()},
+                oneof([{cons, ?CT_SAFE_ANY()},
                        daeh,
                        drop,
                        drop_r,
                        get,
                        get_r,
                        head,
-                       {in, ct_proper_ext:safe_any()},
-                       {in_r, ct_proper_ext:safe_any()},
+                       {in, ?CT_SAFE_ANY()},
+                       {in_r, ?CT_SAFE_ANY()},
                        init,
                        liat,
                        last,
@@ -578,7 +579,7 @@ prop_ops() ->
                        out_r,
                        peek,
                        peek_r,
-                       {snoc, ct_proper_ext:safe_any()},
+                       {snoc, ?CT_SAFE_ANY()},
                        tail])
             ),
             list_queue()
@@ -759,7 +760,7 @@ common_drop_tail(Fn) ->
 common_in_r_cons(Fn) ->
     ?FORALL(
         L,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         begin
             Q = lists:foldl(
                 fun(I, Acc) ->
@@ -789,7 +790,7 @@ common_invalid_pred(Fn) ->
 common_invalid_term(Fn) ->
     ?FORALL(
         {I, NonQueue},
-        {ct_proper_ext:safe_any(), non_queue()},
+        {?CT_SAFE_ANY(), non_queue()},
         expect_badarg(Fn, [I, NonQueue])
     ).
 
@@ -798,7 +799,7 @@ common_invalid_term(Fn) ->
 %%%%%%%%%%%%%%%%%%
 
 list_queue() ->
-    list_queue(ct_proper_ext:safe_any()).
+    list_queue(?CT_SAFE_ANY()).
 
 list_queue(Type) ->
     ?LET(
@@ -815,7 +816,7 @@ list_queue(Type) ->
     ).
 
 queue() ->
-    queue(ct_proper_ext:safe_any()).
+    queue(?CT_SAFE_ANY()).
 
 queue(Type) ->
     ?LET(List, list(Type), queue:from_list(List)).
@@ -831,7 +832,7 @@ queue(Type) ->
 non_queue() ->
     ?SUCHTHAT(
         T,
-        ct_proper_ext:safe_any(),
+        ?CT_SAFE_ANY(),
         not(
             is_tuple(T) andalso
             tuple_size(T) =:= 2 andalso
@@ -843,7 +844,7 @@ non_queue() ->
 non_fun(Arity) ->
     ?SUCHTHAT(
         T,
-        ct_proper_ext:safe_any(),
+        ?CT_SAFE_ANY(),
         not is_function(T, Arity)
     ).
 
diff --git a/lib/stdlib/test/property_test/sets_prop.erl b/lib/stdlib/test/property_test/sets_prop.erl
index b981bdb686..e0453546fb 100644
--- a/lib/stdlib/test/property_test/sets_prop.erl
+++ b/lib/stdlib/test/property_test/sets_prop.erl
@@ -20,9 +20,12 @@
 %% %CopyrightEnd%
 %%
 -module(sets_prop).
+-compile([export_all, nowarn_export_all]).
 
 -include_lib("common_test/include/ct_property_test.hrl").
 
+-record(model, {type, module, content=#{}}).
+
 %%%%%%%%%%%%%%%%%%
 %%% Properties %%%
 %%%%%%%%%%%%%%%%%%
@@ -36,9 +39,9 @@ subprop_add_element(Mod) ->
         {{S0, M0}, Es},
         ?LET(
             {L1, L2, B},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {gen_set(Mod, L1 ++ B), L2 ++ B}
         ),
         begin
@@ -62,9 +65,9 @@ subprop_del_element(Mod) ->
         {{S0, M0}, Es},
         ?LET(
             {L1, L2, B},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {gen_set(Mod, L1 ++ B), L2 ++ B}
         ),
         begin
@@ -86,7 +89,7 @@ prop_filter() ->
 subprop_filter(Mod) ->
     ?FORALL(
         {{S0, M0}, Fun},
-        {gen_set(Mod), function1(boolean())},
+        {gen_set(Mod), function1(bool())},
         is_equal(Mod:filter(Fun, S0),
                  model_filter(Fun, M0))
     ).
@@ -99,10 +102,10 @@ prop_filtermap() ->
 subprop_filtermap(Mod) ->
     ?FORALL(
         {{S0, M0}, Fun},
-	{gen_set(Mod),
-         function1(oneof([true, false, {true, ct_proper_ext:safe_any()}]))},
-	is_equal(Mod:filtermap(Fun, S0),
-                 model_filtermap(Fun, M0))
+        {gen_set(Mod),
+         function1(oneof([true, false, {true, ?CT_SAFE_ANY()}]))},
+        is_equal(Mod:filtermap(wrap(Fun), S0),
+                 model_filtermap(wrap(Fun), M0))
     ).
 
 
@@ -115,7 +118,7 @@ subprop_fold(Mod) ->
         {S, M},
         gen_set(Mod),
         begin
-            Fun = fun(E, Acc) -> Acc + erlang:phash2(E) end,
+            Fun = fun(E, Acc) -> Acc + erlang:phash2(trunc_float(E)) end,
             Mod:fold(Fun, 0, S) =:= model_fold(Fun, 0, M)
         end
     ).
@@ -128,14 +131,14 @@ prop_from_list() ->
 subprop_from_list(sets) ->
     ?FORALL(
         {L, V},
-        {ct_proper_ext:safe_list(), gen_version()},
+        {?CT_SAFE_LIST(), gen_version()},
         is_equal(sets:from_list(L, [{version, V}]),
                  model_from_list(sets, L))
     );
 subprop_from_list(Mod) ->
     ?FORALL(
         L,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         is_equal(Mod:from_list(L),
                  model_from_list(Mod, L))
     ).
@@ -150,8 +153,8 @@ subprop_intersection_1(Mod) ->
         SMs,
         ?LET(
             {Ls, A},
-            {non_empty(list(ct_proper_ext:safe_list())),
-             ct_proper_ext:safe_list()},
+            {non_empty(list(?CT_SAFE_LIST())),
+             ?CT_SAFE_LIST()},
             [gen_set(Mod, L ++ A) || L <- Ls]
         ),
         begin
@@ -171,9 +174,9 @@ subprop_intersection_2(Mod) ->
         {{S1, M1}, {S2, M2}},
         ?LET(
             {L1, L2, B},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {gen_set(Mod, L1 ++ B), gen_set(Mod, L2 ++ B)}
         ),
         is_equal(Mod:intersection(S1, S2),
@@ -190,9 +193,9 @@ subprop_is_disjoint(Mod) ->
         {{S1, M1}, {S2, M2}},
         ?LET(
             {L1, L2, B},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             begin
                 {gen_set(Mod, L1 ++ B), gen_set(Mod, L2 ++ B)}
             end
@@ -210,7 +213,7 @@ subprop_is_element(Mod) ->
         {{S, M}, Es},
         ?LET(
             {L, Extra},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
             {gen_set(Mod, L), L ++ Extra}
         ),
         lists:all(fun(E) ->
@@ -254,7 +257,7 @@ subprop_is_set(sets) ->
         {Exp, {S, _M}},
         oneof([{true, gen_set(sets)},
                {false, {?SUCHTHAT(T,
-                                  ct_proper_ext:safe_any(),
+                                  ?CT_SAFE_ANY(),
                                   not (is_map(T) orelse
                                        is_tuple(T) andalso
                                        tuple_size(T)=:=9 andalso
@@ -267,7 +270,7 @@ subprop_is_set(ordsets) ->
         {Exp, {S, _M}},
         oneof([{true, gen_set(ordsets)},
                {false, {?SUCHTHAT(T,
-                                  ct_proper_ext:safe_any(),
+                                  ?CT_SAFE_ANY(),
                                   not is_list(T)),
                         undefined}}]),
         Exp =:= ordsets:is_set(S)
@@ -277,7 +280,7 @@ subprop_is_set(gb_sets) ->
         {Exp, {S, _M}},
         oneof([{true, gen_set(gb_sets)},
                {false, {?SUCHTHAT(T,
-                                  ct_proper_ext:safe_any(),
+                                  ?CT_SAFE_ANY(),
                                   not (is_tuple(T) andalso
                                        tuple_size(T) =:= 2 andalso
                                        is_integer(element(1, T)) andalso
@@ -320,7 +323,7 @@ subprop_is_subset(Mod) ->
         SMs,
         ?LET(
             {L1, L2},
-            {ct_proper_ext:safe_list(), ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(), ?CT_SAFE_LIST()},
             begin
                 L3Extra = [make_ref()|L2],
                 L2Extra = [make_ref()|L1],
@@ -347,9 +350,9 @@ prop_map() ->
 subprop_map(Mod) ->
     ?FORALL(
         {{S0, M0}, Fun},
-        {gen_set(Mod), function1(ct_proper_ext:safe_any())},
-        is_equal(Mod:map(Fun, S0),
-                 model_map(Fun, M0))
+        {gen_set(Mod), function1(?CT_SAFE_ANY())},
+        is_equal(Mod:map(wrap(Fun), S0),
+                 model_map(wrap(Fun), M0))
     ).
 
 
@@ -374,9 +377,9 @@ subprop_subtract(Mod) ->
         {{S1, M1}, {S2, M2}},
         ?LET(
             {L1, L2, B},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {gen_set(Mod, L1 ++ B), gen_set(Mod, L2 ++ B)}
         ),
         is_equal(Mod:subtract(S1, S2),
@@ -394,7 +397,7 @@ subprop_to_list(Mod) ->
     ?FORALL(
         {S, M},
         gen_set(Mod),
-        list_matchsort(Mod:to_list(S)) =:= list_matchsort(model_to_list(M))
+        list_matchsort(Mod:to_list(S), match) =:= list_matchsort(model_to_list(M), match)
     ).
 
 
@@ -407,7 +410,7 @@ subprop_union_1(Mod) ->
         SMs,
         ?LET(
             {Ls, A},
-            {list(ct_proper_ext:safe_list()), ct_proper_ext:safe_list()},
+            {list(?CT_SAFE_LIST()), ?CT_SAFE_LIST()},
             [gen_set(Mod, L ++ A) || L <- Ls]
         ),
         begin
@@ -427,9 +430,9 @@ subprop_union_2(Mod) ->
         {{S1, M1}, {S2, M2}},
         ?LET(
             {L1, L2, B},
-            {ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list(),
-             ct_proper_ext:safe_list()},
+            {?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST(),
+             ?CT_SAFE_LIST()},
             {gen_set(Mod, L1 ++ B), gen_set(Mod, L2 ++ B)}
         ),
         is_equal(Mod:union(S1, S2),
@@ -444,14 +447,14 @@ subprop_operations(Mod) ->
     ?FORALL(
         {SM0, Ops},
         {gen_set(Mod),
-         list(oneof([{add_element, ct_proper_ext:safe_any()},
-                     {del_element, ct_proper_ext:safe_any()},
-                     {filter, function1(boolean())},
+         list(oneof([{add_element, ?CT_SAFE_ANY()},
+                     {del_element, ?CT_SAFE_ANY()},
+                     {filter, function1(bool())},
                      {filtermap, function1(oneof([true,
                                                   false,
-                                                  {true, ct_proper_ext:safe_any()}]))},
+                                                  {true, ?CT_SAFE_ANY()}]))},
                      {intersection, gen_set(Mod)},
-                     {map, function1(ct_proper_ext:safe_any())},
+                     {map, function1(?CT_SAFE_ANY())},
                      {subtract, gen_set(Mod)},
                      {union, gen_set(Mod)}]))},
         begin
@@ -466,14 +469,14 @@ subprop_operations(Mod) ->
                                            {Mod:filter(Fun, SAcc),
                                             model_filter(Fun, MAcc)};
                                        ({filtermap, Fun}, {SAcc, MAcc}) ->
-                                           {Mod:filtermap(Fun, SAcc),
-                                            model_filtermap(Fun, MAcc)};
+                                           {Mod:filtermap(wrap(Fun), SAcc),
+                                            model_filtermap(wrap(Fun), MAcc)};
                                        ({intersection, {S, M}}, {SAcc, MAcc}) ->
                                            {Mod:intersection(SAcc, S),
                                             model_intersection(MAcc, M)};
                                        ({map, Fun}, {SAcc, MAcc}) ->
-                                           {Mod:map(Fun, SAcc),
-                                            model_map(Fun, MAcc)};
+                                           {Mod:map(wrap(Fun), SAcc),
+                                            model_map(wrap(Fun), MAcc)};
                                        ({subtract, {S, M}}, {SAcc, MAcc}) ->
                                            {Mod:subtract(SAcc, S),
                                             model_subtract(MAcc, M)};
@@ -497,13 +500,13 @@ gen_version() ->
 gen_set(sets) ->
     ?LET(
         {L, V},
-        {ct_proper_ext:safe_list(), gen_version()},
+        {?CT_SAFE_LIST(), gen_version()},
         gen_set(sets, L, V)
     );
 gen_set(Mod) ->
     ?LET(
         L,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         gen_set(Mod, L, 0)
     ).
 
@@ -518,7 +521,7 @@ gen_set(Mod, List) when is_list(List) ->
 gen_set(Mod, Version) when is_integer(Version) ->
     ?LET(
         L,
-        ct_proper_ext:safe_list(),
+        ?CT_SAFE_LIST(),
         gen_set(Mod, L, Version)
     ).
 
@@ -534,8 +537,6 @@ gen_set(Mod, List, _Version) ->
 %%% Model %%%
 %%%%%%%%%%%%%
 
--record(model, {type, module, content=#{}}).
-
 model_new(sets) ->
     #model{type=match, module=sets};
 model_new(ordsets) ->
@@ -543,13 +544,30 @@ model_new(ordsets) ->
 model_new(gb_sets) ->
     #model{type=equal, module=gb_sets}.
 
-model_add_element(E, #model{type=equal, content=C}=M) when is_float(E), trunc(E) == E ->
-    M#model{content=C#{trunc(E) => E}};
+model_add_element(E0, #model{type=equal, content=C}=M) ->
+    E = trunc_float(E0),
+    case maps:is_key(E, C) of
+        true ->
+            M;
+        false ->
+            M#model{content=C#{E => E0}}
+    end;
 model_add_element(E, #model{content=C}=M) ->
     M#model{content=C#{E => E}}.
 
-model_del_element(E, #model{type=equal, content=C}=M) when is_float(E), trunc(E) == E ->
-    M#model{content=maps:remove(trunc(E), C)};
+trunc_float(E) when is_float(E) ->
+    if E == trunc(E) -> trunc(E);
+       true -> E
+    end;
+trunc_float(L) when is_list(L) ->
+    [trunc_float(X) || X <- L];
+trunc_float(T) when is_tuple(T) ->
+    list_to_tuple([trunc_float(X) || X <- tuple_to_list(T)]);
+trunc_float(E) ->
+    E.
+
+model_del_element(E, #model{type=equal, content=C}=M) ->
+    M#model{content=maps:remove(trunc_float(E), C)};
 model_del_element(E, #model{content=C}=M) ->
     M#model{content=maps:remove(E, C)}.
 
@@ -559,8 +577,8 @@ model_from_list(Mod, L) ->
 model_to_list(#model{content=C}) ->
     maps:values(C).
 
-model_is_element(E, #model{type=equal, content=C}) when is_float(E), trunc(E) == E ->
-    maps:is_key(trunc(E), C);
+model_is_element(E, #model{type=equal, content=C}) ->
+    maps:is_key(trunc_float(E), C);
 model_is_element(E, #model{content=C}) ->
     maps:is_key(E, C).
 
@@ -602,7 +620,8 @@ model_intersection(M1, M2) ->
 model_intersection_1([], Acc) ->
     Acc;
 model_intersection_1([#model{module=Mod, content=C1}|Ms], #model{module=Mod, content=C2}=Acc) ->
-    model_intersection_1(Ms, Acc#model{content=maps:with(maps:keys(C2), maps:with(maps:keys(C1), C2))}).
+    C = maps:with(maps:keys(C2), maps:with(maps:keys(C1), C2)),
+    model_intersection_1(Ms, Acc#model{content=C}).
 
 model_union(Mod, []) ->
     model_new(Mod);
@@ -615,7 +634,8 @@ model_union(_Mod, M1, M2) ->
 model_union_1([], Acc) ->
     Acc;
 model_union_1([#model{module=Mod, content=C1}|Ms], #model{module=Mod, content=C2}=Acc) ->
-    model_union_1(Ms, Acc#model{content=maps:merge(C2, C1)}).
+    C = maps:merge(C2, C1),
+    model_union_1(Ms, Acc#model{content=C}).
 
 model_is_subset(#model{module=Mod, content=C1}, #model{module=Mod, content=C2}) ->
     [] =:= maps:keys(C1) -- maps:keys(C2).
@@ -631,23 +651,29 @@ model_is_disjoint(M1, M2) ->
 %%% Helpers %%%
 %%%%%%%%%%%%%%%
 
+wrap(Fun) ->
+    %% For the tests to work, funs need to generate
+    %% the same answer if it contains keys that can be
+    %% either float or int. For example after a union
+    %% it is not known/specified from which argument the kept
+    %% the element.
+    fun(X0) -> Fun(trunc_float(X0)) end.
+
 test_all(Fun) ->
     conjunction([{T, Fun(T)} || T <- [sets, ordsets, gb_sets]]).
 
-list_matchsort(L) ->
-    lists:sort(fun
-                   (A, B) when is_float(A), is_integer(B) ->
-                       true;
-                   (A, B) when is_integer(A), is_float(B) ->
-                       false;
-                   (A, B) ->
-                       A =< B
-               end,
-               L).
+list_matchsort(L, equal) ->
+    lists:sort(L);
+list_matchsort(L, match) ->
+    %% Ugly hack or clever cheat, you decide
+    %% We really need to sort: [ [1], [1.0] ] and [ [1.0], [1] ]
+    %% and [0.0, -0.0] floats include inside deep structures.
+    Map = #{E => [] || E <- L},
+    [E || E := _ <- maps:iterator(Map, ordered)].
 
 is_equal(S, #model{type=T, module=Mod, content=C}) ->
-    L1 = list_matchsort(Mod:to_list(S)),
-    L2 = list_matchsort(maps:keys(C)),
+    L1 = list_matchsort(Mod:to_list(S), T),
+    L2 = list_matchsort(maps:keys(C), T),
     case T of
         match -> L1 =:= L2;
         equal -> L1 == L2
diff --git a/lib/stdlib/test/property_test/shell_docs_prop.erl b/lib/stdlib/test/property_test/shell_docs_prop.erl
index 0abbcc1678..a1f2deeaf6 100644
--- a/lib/stdlib/test/property_test/shell_docs_prop.erl
+++ b/lib/stdlib/test/property_test/shell_docs_prop.erl
@@ -25,7 +25,7 @@
 %%% This will include the .hrl file for the installed testing tool:
 -include_lib("common_test/include/ct_property_test.hrl").
 -include_lib("kernel/include/eep48.hrl").
--compile([export_all]).
+-compile([export_all, nowarn_export_all]).
 
 prop_render() ->
     numtests(10000,
@@ -111,10 +111,10 @@ characters() ->
          unicode:characters_to_binary(Str)).
 
 printable_character() ->
-    oneof([integer($\040,$\176),
-           integer(16#A0, 16#D800-1),
-           integer(16#DFFF+1,16#FFFE-1),
-           integer(16#FFFF+1,16#10FFFF),
+    oneof([choose($\040,$\176),
+           choose(16#A0, 16#D800-1),
+           choose(16#DFFF+1,16#FFFE-1),
+           choose(16#FFFF+1,16#10FFFF),
            $\n,$\r,$\t,$\v,$\b,$\f,$\e]).
 
 fmax(What,Depth,S,E) when not is_list(What) ->
@@ -122,8 +122,8 @@ fmax(What,Depth,S,E) when not is_list(What) ->
 fmax(What,Depth,S,E) ->
     Cnt =
         lists:foldl(
-          fun(E,Cnt) ->
-                  case lists:member(E,What) of
+          fun(El,Cnt) ->
+                  case lists:member(El,What) of
                       true ->
                           Cnt+1;
                       false ->
diff --git a/lib/stdlib/test/property_test/uri_string_recompose.erl b/lib/stdlib/test/property_test/uri_string_recompose.erl
index 419d7b3297..f6958d85f7 100644
--- a/lib/stdlib/test/property_test/uri_string_recompose.erl
+++ b/lib/stdlib/test/property_test/uri_string_recompose.erl
@@ -21,7 +21,7 @@
 %%
 -module(uri_string_recompose).
 
--compile(export_all).
+-compile([export_all, nowarn_export_all]).
 
 -proptest(eqc).
 -proptest([triq,proper]).
@@ -444,7 +444,7 @@ host_uri() ->
 %%-------------------------------------------------------------------------
 port() ->
     frequency([{10, undefined},
-               {10, range(1,65535)}
+               {10, choose(1,65535)}
               ]).
 
 query_map() ->
@@ -478,8 +478,8 @@ fragment_uri() ->
 scheme() ->
     ?SIZED(Length, scheme_start(Length, [])).
 %%
-scheme_start(0, L) ->
-    ?LET(Gen, L, lists:reverse(Gen));
+scheme_start(0, []) ->
+    [alpha()];
 scheme_start(N, L) ->
     scheme(N-1,[alpha()|L]).
 
@@ -528,14 +528,14 @@ unreserved() ->
               ]).
 
 unicode_char() ->
-    range(913, 1023).
+    choose(913, 1023).
 
 alpha() ->
-    frequency([{20, range($a, $z)},              % letters
-               {20, range($A, $Z)}]).            % letters
+    frequency([{20, choose($a, $z)},              % letters
+               {20, choose($A, $Z)}]).            % letters
 
 digit() ->
-    range($0, $9).                               % numbers
+    choose($0, $9).                               % numbers
 
 pct_encoded() ->
     oneof(["%C3%A4", "%C3%A5", "%C3%B6"]).
-- 
2.51.0

openSUSE Build Service is sponsored by