File 7314-crypto-Update-property-tests-to-use-ct-property-fram.patch of Package erlang
From 81f9294348fb695b7286c0fff38cb495bed040cb Mon Sep 17 00:00:00 2001
From: Dan Gudmundsson <dgud@erlang.org>
Date: Mon, 2 Mar 2026 17:44:42 +0100
Subject: [PATCH 4/6] crypto: Update property tests to use ct property
framework
Using QuickCheck if available, though `crypto_ng_api_stateful.erl` is
skipped if Quickcheck is used.
---
lib/crypto/test/crypto_property_test_SUITE.erl | 13 +++++++++----
.../test/property_test/crypto_ng_api_stateful.erl | 6 +++++-
.../test/property_test/crypto_prop_generators.erl | 4 ++--
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/lib/crypto/test/crypto_property_test_SUITE.erl b/lib/crypto/test/crypto_property_test_SUITE.erl
index e04b037ca2..05c97719c6 100644
--- a/lib/crypto/test/crypto_property_test_SUITE.erl
+++ b/lib/crypto/test/crypto_property_test_SUITE.erl
@@ -76,8 +76,13 @@ init_update(Config) ->
).
init_update_multi(Config) ->
- ct_property_test:quickcheck(
- crypto_ng_api_stateful:prop__crypto_init_multi(Config),
- Config
- ).
+ case proplists:get_value(property_test_tool, Config, undefined) of
+ proper ->
+ ct_property_test:quickcheck(
+ crypto_ng_api_stateful:prop__crypto_init_multi(Config),
+ Config
+ );
+ _ ->
+ {skip, "proper required, not found"}
+ end.
diff --git a/lib/crypto/test/property_test/crypto_ng_api_stateful.erl b/lib/crypto/test/property_test/crypto_ng_api_stateful.erl
index 20320f2af3..aa696eb25c 100644
--- a/lib/crypto/test/property_test/crypto_ng_api_stateful.erl
+++ b/lib/crypto/test/property_test/crypto_ng_api_stateful.erl
@@ -23,7 +23,9 @@
-module(crypto_ng_api_stateful).
--compile(export_all).
+-compile([export_all, nowarn_export_all]).
+
+-ifdef(PROPER).
-include_lib("common_test/include/ct_property_test.hrl").
-include("crypto_prop_generators.hrl").
@@ -161,3 +163,5 @@ decrypt({_EncRef,DecRef}, CT) ->
%%%----------------------------------------------------------------
refs(S) -> [Refs || {Refs,_} <- maps:to_list(S)].
+
+-endif.
diff --git a/lib/crypto/test/property_test/crypto_prop_generators.erl b/lib/crypto/test/property_test/crypto_prop_generators.erl
index 62ef2477c0..90cab6da6a 100644
--- a/lib/crypto/test/property_test/crypto_prop_generators.erl
+++ b/lib/crypto/test/property_test/crypto_prop_generators.erl
@@ -53,13 +53,13 @@ iv(Cipher) ->
%% Can't be shrunk
crypto:strong_rand_bytes( iv_length(Cipher) ).
-iolist() -> frequency([{5, list( oneof([list(byte()),
+iolist() -> frequency([{5, list( oneof([list(?CT_BYTE()),
binary(),
list(binary())]))},
{1, mybinary(50000)}
]).
-mybinary(MaxSize) -> ?LET(Sz, integer(0,MaxSize), binary(Sz)).
+mybinary(MaxSize) -> ?LET(Sz, choose(0,MaxSize), binary(Sz)).
padding() -> oneof([pkcs_padding, none,
zero, random,
--
2.51.0