projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test/ctype_internal_test.c: portability fixup.
[openssl.git]
/
test
/
sanitytest.c
diff --git
a/test/sanitytest.c
b/test/sanitytest.c
index 3ef0a37207e40fd1bd5843d430a38efb0612454d..da74e7eca1ac668303cb0fd1163ae2646db488cb 100644
(file)
--- a/
test/sanitytest.c
+++ b/
test/sanitytest.c
@@
-8,10
+8,8
@@
*/
#include <string.h>
*/
#include <string.h>
-#include <internal/numbers.h>
-
-#include "test_main.h"
#include "testutil.h"
#include "testutil.h"
+#include "internal/numbers.h"
static int test_sanity_null_zero(void)
{
static int test_sanity_null_zero(void)
{
@@
-20,7
+18,7
@@
static int test_sanity_null_zero(void)
/* Is NULL equivalent to all-bytes-zero? */
p = NULL;
/* 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));
}
return TEST_mem_eq(&p, sizeof(p), bytes, sizeof(bytes));
}
@@
-67,7
+65,7
@@
static int test_sanity_sign(void)
return 1;
}
return 1;
}
-static int test_sanity_unsigned_conver
t
ion(void)
+static int test_sanity_unsigned_conver
s
ion(void)
{
/* Check that unsigned-to-signed conversions preserve bit patterns */
if (!TEST_int_eq((int)((unsigned int)INT_MAX + 1), INT_MIN)
{
/* Check that unsigned-to-signed conversions preserve bit patterns */
if (!TEST_int_eq((int)((unsigned int)INT_MAX + 1), INT_MIN)
@@
-76,12
+74,24
@@
static int test_sanity_unsigned_convertion(void)
return 1;
}
return 1;
}
-void register_tests(void)
+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);
ADD_TEST(test_sanity_enum_size);
ADD_TEST(test_sanity_twos_complement);
ADD_TEST(test_sanity_sign);
{
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);
+ return 1;
}
}