3 #include "ntp_stdlib.h"
4 #include "isc/string.h"
8 /* Basisc test for timingsafe_memcmp() */
10 void test_Empty(void);
11 void test_Equal(void);
12 void test_FirstByte(void);
13 void test_LastByte(void);
14 void test_MiddleByte(void);
15 void test_MiddleByteUpLo(void);
19 static const char dummy[1];
20 TEST_ASSERT_EQUAL_INT(0, isc_tsmemcmp(NULL , NULL , 0));
21 TEST_ASSERT_EQUAL_INT(0, isc_tsmemcmp(dummy, dummy, 0));
26 static const char dummy[2][4] = {
29 TEST_ASSERT_EQUAL_INT(0, isc_tsmemcmp(dummy[0],
34 void test_FirstByte(void)
36 static const char dummy[2][4] = {
39 TEST_ASSERT_EQUAL_INT(-1, isc_tsmemcmp(dummy[0],
42 TEST_ASSERT_EQUAL_INT( 1, isc_tsmemcmp(dummy[1],
47 void test_LastByte(void)
49 static const char dummy[2][4] = {
52 TEST_ASSERT_EQUAL_INT(-1, isc_tsmemcmp(dummy[0],
55 TEST_ASSERT_EQUAL_INT( 1, isc_tsmemcmp(dummy[1],
60 void test_MiddleByte(void)
62 static const char dummy[2][4] = {
65 TEST_ASSERT_EQUAL_INT(-1, isc_tsmemcmp(dummy[0],
68 TEST_ASSERT_EQUAL_INT( 1, isc_tsmemcmp(dummy[1],
73 void test_MiddleByteUpLo(void)
75 static const char dummy[2][4] = {
78 TEST_ASSERT_EQUAL_INT(-1, isc_tsmemcmp(dummy[0],
81 TEST_ASSERT_EQUAL_INT( 1, isc_tsmemcmp(dummy[1],