summaryrefslogtreecommitdiffstats
path: root/test/sanitytest.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2017-08-17 02:10:07 +0200
committerPauli <paul.dale@oracle.com>2017-09-27 22:53:40 +0200
commit1b3e2bbf64b96f636277ca29b31ba152c1831e74 (patch)
tree10a9f89306c04e3133f5e9c231e6aa4aa2a8841a /test/sanitytest.c
parentBN_copy now propagates BN_FLG_CONSTTIME (diff)
downloadopenssl-1b3e2bbf64b96f636277ca29b31ba152c1831e74.tar.xz
openssl-1b3e2bbf64b96f636277ca29b31ba152c1831e74.zip
Add a reserve call to the stack data structure.
This allows the caller to guarantee that there is sufficient space for a number of insertions without reallocation. The expansion ratio when reallocating the array is reduced to 1.5 rather than 2. Change bounds testing to use a single size rather than both INT_MAX and SIZE_MAX. This simplifies some of the tests. Switch the stack pointers to data from char * to void * Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4386)
Diffstat (limited to 'test/sanitytest.c')
-rw-r--r--test/sanitytest.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/sanitytest.c b/test/sanitytest.c
index 743c03b2d9..c1c51a2b9a 100644
--- a/test/sanitytest.c
+++ b/test/sanitytest.c
@@ -75,6 +75,16 @@ static int test_sanity_unsigned_convertion(void)
return 1;
}
+static int test_sanity_range(void)
+{
+ /* This isn't possible to check using the framework functions */
+ if (SIZE_MAX < INT_MAX) {
+ TEST_error("int must not be wider than size_t");
+ return 0;
+ }
+ return 1;
+}
+
int setup_tests(void)
{
ADD_TEST(test_sanity_null_zero);
@@ -82,6 +92,7 @@ int setup_tests(void)
ADD_TEST(test_sanity_twos_complement);
ADD_TEST(test_sanity_sign);
ADD_TEST(test_sanity_unsigned_convertion);
+ ADD_TEST(test_sanity_range);
return 1;
}