X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=test%2Fsanitytest.c;h=46cd224e7a21cff18d469c90b06b61a1687946b0;hb=454afd9866300b984306c5b565a9d55568a5bc50;hp=743c03b2d936409f3ce9a112a44f2a5bc94d2599;hpb=176db6dc51ec0a972bfa8836cfdab8f6767c978a;p=oweals%2Fopenssl.git diff --git a/test/sanitytest.c b/test/sanitytest.c index 743c03b2d9..46cd224e7a 100644 --- a/test/sanitytest.c +++ b/test/sanitytest.c @@ -1,16 +1,15 @@ /* - * Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2015-2018 The OpenSSL Project Authors. 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 -#include "internal/numbers.h" - #include "testutil.h" +#include "internal/numbers.h" static int test_sanity_null_zero(void) { @@ -19,7 +18,7 @@ static int test_sanity_null_zero(void) /* Is NULL equivalent to all-bytes-zero? */ p = NULL; - memset(bytes, 0, sizeof bytes); + memset(bytes, 0, sizeof(bytes)); return TEST_mem_eq(&p, sizeof(p), bytes, sizeof(bytes)); } @@ -66,7 +65,7 @@ static int test_sanity_sign(void) return 1; } -static int test_sanity_unsigned_convertion(void) +static int test_sanity_unsigned_conversion(void) { /* Check that unsigned-to-signed conversions preserve bit patterns */ if (!TEST_int_eq((int)((unsigned int)INT_MAX + 1), INT_MIN) @@ -75,13 +74,30 @@ 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; +} + +static int test_sanity_memcmp(void) +{ + return CRYPTO_memcmp("ab","cd",2); +} + int setup_tests(void) { ADD_TEST(test_sanity_null_zero); ADD_TEST(test_sanity_enum_size); ADD_TEST(test_sanity_twos_complement); ADD_TEST(test_sanity_sign); - ADD_TEST(test_sanity_unsigned_convertion); + ADD_TEST(test_sanity_unsigned_conversion); + ADD_TEST(test_sanity_range); + ADD_TEST(test_sanity_memcmp); return 1; }