* Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*
- * Licensed under the OpenSSL license (the "License"). You may not use
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
#include <openssl/err.h>
#include <openssl/crypto.h>
-#include "e_os.h"
+#include "internal/nelem.h"
#include "testutil.h"
/* The macros below generate unused functions which error out one of the clang
return 0;
}
-static int test_int_stack(void)
+static int test_int_stack(int reserve)
{
static int v[] = { 1, 2, -4, 16, 999, 1, -173, 1, 9 };
static int notpresent = -1;
int i;
int testresult = 0;
+ if (!TEST_ptr(s)
+ || (reserve > 0 && !TEST_true(sk_sint_reserve(s, 5 * reserve))))
+ goto end;
+
/* Check push and num */
for (i = 0; i < n; i++) {
if (!TEST_int_eq(sk_sint_num(s), i)) {
return **a - (signed int)**b;
}
-static int test_uchar_stack(void)
+static int test_uchar_stack(int reserve)
{
static const unsigned char v[] = { 1, 3, 7, 5, 255, 0 };
const int n = OSSL_NELEM(v);
int i;
int testresult = 0;
+ if (!TEST_ptr(s)
+ || (reserve > 0 && !TEST_true(sk_uchar_reserve(s, 5 * reserve))))
+ goto end;
+
/* unshift and num */
for (i = 0; i < n; i++) {
if (!TEST_int_eq(sk_uchar_num(s), i)) {
return testresult;
}
-void register_tests(void)
+int setup_tests(void)
{
- ADD_TEST(test_int_stack);
- ADD_TEST(test_uchar_stack);
+ ADD_ALL_TESTS(test_int_stack, 4);
+ ADD_ALL_TESTS(test_uchar_stack, 4);
ADD_TEST(test_SS_stack);
ADD_TEST(test_SU_stack);
+ return 1;
}