#define MD5_LENGTH 16
#define SHA1_LENGTH 20
+
void test_MakeMd5Mac(void) {
const char* PKT_DATA = "abcdefgh0123";
}
-void test_ReadEmptyKeyFile() {
+void test_ReadEmptyKeyFile(void) {
struct key* keys = NULL;
TEST_ASSERT_EQUAL(0, auth_init(CreatePath("key-test-empty", INPUT_DIR), &keys));
TEST_ASSERT_TRUE(keys == NULL);
}
-void test_ReadASCIIKeys() {
+void test_ReadASCIIKeys(void) {
struct key* keys = NULL;
TEST_ASSERT_EQUAL(2, auth_init(CreatePath("key-test-ascii", INPUT_DIR), &keys));
TEST_ASSERT_TRUE(CompareKeysAlternative(50, 11, "MD5", "asciikeyOne", *result));
}
-void test_ReadHexKeys() {
+void test_ReadHexKeys(void) {
struct key* keys = NULL;
TEST_ASSERT_EQUAL(3, auth_init(CreatePath("key-test-hex", INPUT_DIR), &keys));
TEST_ASSERT_TRUE(CompareKeysAlternative(30, 13, "MD5", data2, *result));
}
-void test_ReadKeyFileWithComments() {
+void test_ReadKeyFileWithComments(void) {
struct key* keys = NULL;
TEST_ASSERT_EQUAL(2, auth_init(CreatePath("key-test-comments", INPUT_DIR), &keys));
TEST_ASSERT_TRUE(CompareKeysAlternative(34, 3, "MD5", "xyz", *result));
}
-void test_ReadKeyFileWithInvalidHex() {
+void test_ReadKeyFileWithInvalidHex(void) {
struct key* keys = NULL;
TEST_ASSERT_EQUAL(1, auth_init(CreatePath("key-test-invalid-hex", INPUT_DIR), &keys));
}
-void test_SingleEntryHandling() {
+void test_SingleEntryHandling(void) {
char HOST[] = "192.0.2.5";
char REASON[] = "DENY";
TEST_ASSERT_EQUAL_STRING(REASON, result->type);
}
-void test_MultipleEntryHandling() {
+void test_MultipleEntryHandling(void) {
char HOST1[] = "192.0.2.3";
char REASON1[] = "DENY";
free(result);
}
-void test_NoMatchInSearch() {
+void test_NoMatchInSearch(void) {
char HOST_ADD[] = "192.0.2.6";
char HOST_NOTADD[] = "192.0.6.1";
char REASON[] = "DENY";
TEST_ASSERT_TRUE(result == NULL);
}
-void test_AddDuplicate() {
+void test_AddDuplicate(void) {
char HOST[] = "192.0.2.3";
char REASON1[] = "RATE";
char REASON2[] = "DENY";
free(result2);
}
-void test_DeleteEntry() {
+void test_DeleteEntry(void) {
char HOST1[] = "192.0.2.1";
char HOST2[] = "192.0.2.2";
char HOST3[] = "192.0.2.3";
extern struct kod_entry** kod_db;
extern char* kod_db_file;
-void setUp() {
+void setUp(void) {
kod_db_cnt = 0;
kod_db = NULL;
}
-void tearDown() {
+void tearDown(void) {
}
-void test_ReadEmptyFile() {
+void test_ReadEmptyFile(void) {
kod_init_kod_db(CreatePath("kod-test-empty", INPUT_DIR), TRUE);
TEST_ASSERT_EQUAL(0, kod_db_cnt);
}
-void test_ReadCorrectFile() {
+void test_ReadCorrectFile(void) {
kod_init_kod_db(CreatePath("kod-test-correct", INPUT_DIR), TRUE);
TEST_ASSERT_EQUAL(2, kod_db_cnt);
TEST_ASSERT_EQUAL(0xfff, res->timestamp);
}
-void test_ReadFileWithBlankLines() {
+void test_ReadFileWithBlankLines(void) {
kod_init_kod_db(CreatePath("kod-test-blanks", INPUT_DIR), TRUE);
TEST_ASSERT_EQUAL(3, kod_db_cnt);
TEST_ASSERT_EQUAL(0xabcd, res->timestamp);
}
-void test_WriteEmptyFile() {
+void test_WriteEmptyFile(void) {
//kod_db_file = estrdup(CreatePath("kod-output-blank", OUTPUT_DIR)); //causing issues on psp-at1, replaced
kod_db_file = estrdup("kod-output-blank");
//printf("kod PATH: %s\n",kod_db_file);
fclose(is);
}
-void test_WriteFileWithSingleEntry() {
+void test_WriteFileWithSingleEntry(void) {
//kod_db_file = estrdup(CreatePath("kod-output-single", OUTPUT_DIR)); //causing issues on psp-at1, replaced
kod_db_file = estrdup("kod-output-single");
//printf("kod PATH: %s\n",kod_db_file);
TEST_ASSERT_TRUE(CompareFileContent(expected, actual));
}
-void test_WriteFileWithMultipleEntries() {
+void test_WriteFileWithMultipleEntries(void) {
//kod_db_file = estrdup(CreatePath("kod-output-multiple", OUTPUT_DIR)); //causing issues on psp-at1, replaced
kod_db_file = estrdup("kod-output-multiple");
//printf("kod PATH: %s\n",kod_db_file);
PrepareAuthenticationTest(key_id, key_len, "MD5", key_seq);
}
-void setUp() {
+void setUp(void) {
sntptest();
restoreKeyDb = false;
}
-void tearDown() {
+void tearDown(void) {
if (restoreKeyDb) {
key_cnt = 0;
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
-extern void test_ReadEmptyKeyFile();
-extern void test_ReadASCIIKeys();
-extern void test_ReadHexKeys();
-extern void test_ReadKeyFileWithComments();
-extern void test_ReadKeyFileWithInvalidHex();
+void resetTest(void);
+extern void test_ReadEmptyKeyFile(void);
+extern void test_ReadASCIIKeys(void);
+extern void test_ReadHexKeys(void);
+extern void test_ReadKeyFileWithComments(void);
+extern void test_ReadKeyFileWithInvalidHex(void);
//=======Test Reset Option=====
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
-extern void test_SingleEntryHandling();
-extern void test_MultipleEntryHandling();
-extern void test_NoMatchInSearch();
-extern void test_AddDuplicate();
-extern void test_DeleteEntry();
+void resetTest(void);
+extern void test_SingleEntryHandling(void);
+extern void test_MultipleEntryHandling(void);
+extern void test_NoMatchInSearch(void);
+extern void test_AddDuplicate(void);
+extern void test_DeleteEntry(void);
//=======Test Reset Option=====
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
-extern void test_ReadEmptyFile();
-extern void test_ReadCorrectFile();
-extern void test_ReadFileWithBlankLines();
-extern void test_WriteEmptyFile();
-extern void test_WriteFileWithSingleEntry();
-extern void test_WriteFileWithMultipleEntries();
+void resetTest(void);
+extern void test_ReadEmptyFile(void);
+extern void test_ReadCorrectFile(void);
+extern void test_ReadFileWithBlankLines(void);
+extern void test_WriteEmptyFile(void);
+extern void test_WriteFileWithSingleEntry(void);
+extern void test_WriteFileWithMultipleEntries(void);
//=======Test Reset Option=====
extern void setUp(void);
extern void tearDown(void);
void resetTest(void);
-extern void test_IPv4Address();
-extern void test_IPv6Address();
-extern void test_SetLiVnMode1();
-extern void test_SetLiVnMode2();
-extern void test_PktOutput();
-extern void test_LfpOutputBinaryFormat();
-extern void test_LfpOutputDecimalFormat();
+extern void test_IPv4Address(void);
+extern void test_IPv6Address(void);
+extern void test_SetLiVnMode1(void);
+extern void test_SetLiVnMode2(void);
+extern void test_PktOutput(void);
+extern void test_LfpOutputBinaryFormat(void);
+extern void test_LfpOutputDecimalFormat(void);
//=======Test Reset Option=====
progname = argv[0];
Unity.TestFile = "utilities.c";
UnityBegin("utilities.c");
- RUN_TEST(test_IPv4Address, 68);
- RUN_TEST(test_IPv6Address, 78);
- RUN_TEST(test_SetLiVnMode1, 98);
- RUN_TEST(test_SetLiVnMode2, 111);
- RUN_TEST(test_PktOutput, 126);
- RUN_TEST(test_LfpOutputBinaryFormat, 146);
- RUN_TEST(test_LfpOutputDecimalFormat, 162);
+ RUN_TEST(test_IPv4Address, 66);
+ RUN_TEST(test_IPv6Address, 76);
+ RUN_TEST(test_SetLiVnMode1, 96);
+ RUN_TEST(test_SetLiVnMode2, 109);
+ RUN_TEST(test_PktOutput, 124);
+ RUN_TEST(test_LfpOutputBinaryFormat, 144);
+ RUN_TEST(test_LfpOutputDecimalFormat, 160);
return (UnityEnd());
}
#include "ntp_stdlib.h"
#include "sntp-opts.h"
+void sntptest(void);
+void sntptest_destroy(void);
+void ActivateOption(const char* option, const char* argument);
-sntptest() {
+void sntptest(void) {
optionSaveState(&sntpOptions);
}
-sntptest_destroy() {
+void sntptest_destroy(void) {
optionRestore(&sntpOptions);
}
bool outputFileOpened;
FILE* outputFile;
-//debugUtilitiesTest() : outputFileOpened(false) {}
-
void InitDebugTest(const char * filename) {
// Clear the contents of the current file.
// Open the output file
* tests can be removed.
*/
-void test_IPv4Address() {
+void test_IPv4Address(void) {
const char* ADDR = "192.0.2.10";
sockaddr_u input = CreateSockaddr4(ADDR);
TEST_ASSERT_EQUAL_STRING(ADDR, addrinfo_to_str(&inputA));
}
-void test_IPv6Address() {
+void test_IPv6Address(void) {
const struct in6_addr address = {
0x20, 0x01, 0x0d, 0xb8,
0x85, 0xa3, 0x08, 0xd3,
TEST_ASSERT_EQUAL_STRING(expected, addrinfo_to_str(&inputA));
}
-void test_SetLiVnMode1() {
+void test_SetLiVnMode1(void) {
struct pkt expected;
expected.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
NTP_VERSION,
TEST_ASSERT_EQUAL(expected.li_vn_mode, actual.li_vn_mode);
}
-void test_SetLiVnMode2() {
+void test_SetLiVnMode2(void) {
struct pkt expected;
expected.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOTINSYNC,
NTP_OLDVERSION,
/* Debug utilities tests */
-void test_PktOutput() {
+void test_PktOutput(void) {
char * filename = "debug-output-pkt";//CreatePath("debug-output-pkt", OUTPUT_DIR);
InitDebugTest(filename);
FinishDebugTest(CreatePath("debug-input-pkt", INPUT_DIR), filename);
}
-void test_LfpOutputBinaryFormat() {
+void test_LfpOutputBinaryFormat(void) {
char * filename = "debug-output-lfp-bin";//CreatePath("debug-output-lfp-bin", OUTPUT_DIR);
InitDebugTest(filename);
FinishDebugTest(CreatePath("debug-input-lfp-bin", INPUT_DIR), filename);
}
-void test_LfpOutputDecimalFormat() {
+void test_LfpOutputDecimalFormat(void) {
char * filename = "debug-output-lfp-dec"; //CreatePath("debug-output-lfp-dec", OUTPUT_DIR);
InitDebugTest(filename);