[Git][NTPsec/ntpsec][master] 8 commits: Rename ntpdig test filenames to something more sane.

Amar Takhar gitlab at mg.gitlab.com
Sat Dec 5 00:21:18 UTC 2015


Amar Takhar pushed to branch master at NTPsec / ntpsec


Commits:
e71a5aba by Amar Takhar at 2015-12-04T16:55:37Z
Rename ntpdig test filenames to something more sane.

Also remove CAPS.

- - - - -
a516bf59 by Amar Takhar at 2015-12-04T16:57:09Z
Move file_handling.c to common_source.

- - - - -
f51dce3b by Amar Takhar at 2015-12-04T17:41:27Z
Remove debug printf.

- - - - -
07e67022 by Amar Takhar at 2015-12-04T17:54:04Z
Remove comment marker the change is permanent.

- - - - -
f0d37665 by Amar Takhar at 2015-12-04T17:55:26Z
Remove GETTIMEOFDAY macro.

- - - - -
c27db01c by Amar Takhar at 2015-12-04T17:56:40Z
Merge branch 'tmp'

- - - - -
841b29a3 by Amar Takhar at 2015-12-04T19:16:39Z
Add a simple EXPECT_DOUBLE_EQ macro.

- - - - -
99d9a0be by Amar Takhar at 2015-12-04T19:18:58Z
Re-enable disabled IllegalCharInPort test.

This is actually doing the right thing, the printfs are sending spam to stdout
which makes it seem like it's failing.

- - - - -


9 changed files:

- tests/libntp/a_md5encrypt.c
- tests/libntp/decodenetnum.c
- tests/libntp/lfptostr.c
- tests/ntpdig/keyFile.c → tests/ntpdig/key_file.c
- tests/ntpdig/kodDatabase.c → tests/ntpdig/kod_database.c
- tests/ntpdig/kodFile.c → tests/ntpdig/kod_file.c
- tests/ntpdig/packetHandling.c → tests/ntpdig/packet_handling.c
- tests/ntpdig/packetProcessing.c → tests/ntpdig/packet_processing.c
- tests/wscript


Changes:

=====================================
tests/libntp/a_md5encrypt.c
=====================================
--- a/tests/libntp/a_md5encrypt.c
+++ b/tests/libntp/a_md5encrypt.c
@@ -29,7 +29,7 @@ const char *packet = "ijklmnopqrstuvwx";
 const int packetLength = 16;
 const int keyIdLength = 4;
 const int digestLength = 16;
-const int totalLength = 36; //XXX: error: initializer element is not constant packetLength + keyIdLength + digestLength;
+const int totalLength = 36; //error: initializer element is not constant packetLength + keyIdLength + digestLength;
 const char *expectedPacket = "ijklmnopqrstuvwx\0\0\0\0\x0c\x0e\x84\xcf\x0b\xb7\xa8\x68\x8e\x52\x38\xdb\xbc\x1c\x39\x53";
 
 TEST(a_md5encrypt, Encrypt) {


=====================================
tests/libntp/decodenetnum.c
=====================================
--- a/tests/libntp/decodenetnum.c
+++ b/tests/libntp/decodenetnum.c
@@ -108,5 +108,5 @@ TEST_GROUP_RUNNER(decodenetnum) {
 	RUN_TEST_CASE(decodenetnum, IPv6AddressOnly);
 	RUN_TEST_CASE(decodenetnum, IPv6AddressWithPort);
 	RUN_TEST_CASE(decodenetnum, IllegalAddress);
-//XXX	RUN_TEST_CASE(decodenetnum, IllegalCharInPort);  Expected sa_family: 2 but got: 188
+	RUN_TEST_CASE(decodenetnum, IllegalCharInPort);
 }


=====================================
tests/libntp/lfptostr.c
=====================================
--- a/tests/libntp/lfptostr.c
+++ b/tests/libntp/lfptostr.c
@@ -30,7 +30,6 @@ static const int HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
 
 
 TEST(lfptostr, PositiveInteger) {
-	printf("beeeeeeeeeeer: %d\n", THREE_FOURTH);
 	l_fp test = {{200}, 0}; // exact 200.0000000000
 
 	TEST_ASSERT_EQUAL_STRING("200.0000000000", mfptoa(test.l_ui, test.l_uf, LFP_MAX_PRECISION));


=====================================
tests/ntpdig/keyFile.c → tests/ntpdig/key_file.c
=====================================
--- a/tests/ntpdig/keyFile.c
+++ b/tests/ntpdig/key_file.c


=====================================
tests/ntpdig/kodDatabase.c → tests/ntpdig/kod_database.c
=====================================
--- a/tests/ntpdig/kodDatabase.c
+++ b/tests/ntpdig/kod_database.c


=====================================
tests/ntpdig/kodFile.c → tests/ntpdig/kod_file.c
=====================================
--- a/tests/ntpdig/kodFile.c
+++ b/tests/ntpdig/kod_file.c


=====================================
tests/ntpdig/packetHandling.c → tests/ntpdig/packet_handling.c
=====================================
--- a/tests/ntpdig/packetHandling.c
+++ b/tests/ntpdig/packet_handling.c
@@ -9,10 +9,13 @@
 #include "ntp.h"
 
 #include <sys/time.h>
+#include <stdlib.h>
 
-#define GETTIMEOFDAY gettimeofday /* XXX: why? */
-#define EXPECT_DOUBLE_EQ(a, b) {} /* XXX: Not part of Unity */
 
+#define EXPECT_DOUBLE_EQ(a, b) { \
+	float max = 0.0000000001; \
+	TEST_ASSERT_TRUE(abs(a - b) < max); \
+}
 
 static bool LfpEquality(const l_fp* expected, const l_fp* actual) {
 	if (L_ISEQU(expected, actual)) {
@@ -34,11 +37,12 @@ TEST_SETUP(packetHandling) {}
 TEST_TEAR_DOWN(packetHandling) {}
 
 TEST(packetHandling, GenerateUnauthenticatedPacket) {
+
 	struct pkt testpkt;
 	struct timeval xmt;
 	l_fp expected_xmt, actual_xmt;
 
-	GETTIMEOFDAY(&xmt, NULL);
+	gettimeofday(&xmt, NULL);
 	xmt.tv_sec += JAN_1970;
 
 	TEST_ASSERT_EQUAL(LEN_PKT_NOMAC,
@@ -70,7 +74,7 @@ TEST(packetHandling, GenerateAuthenticatedPacket) {
 	memcpy(testkey.key_seq, "123456789", testkey.key_len);
 	memcpy(testkey.type, "MD5", 3);
 
-	GETTIMEOFDAY(&xmt, NULL);
+	gettimeofday(&xmt, NULL);
 	xmt.tv_sec += JAN_1970;
 
 	TEST_ASSERT_EQUAL(EXPECTED_PKTLEN,


=====================================
tests/ntpdig/packetProcessing.c → tests/ntpdig/packet_processing.c
=====================================
--- a/tests/ntpdig/packetProcessing.c
+++ b/tests/ntpdig/packet_processing.c


=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -19,18 +19,18 @@ def build(ctx):
 	common_source = [
 		"common/tests_main.c",
 		"common/caltime.c",
-		"common/sockaddrtest.c"
+		"common/sockaddrtest.c",
+		"common/file_handling.c"
 	]
 
 
 	ntpdig_source = [
 		"ntpdig/crypto.c",
-		"common/file_handling.c",
-		"ntpdig/keyFile.c",
-		"ntpdig/kodDatabase.c",
-		"ntpdig/kodFile.c",
-		"ntpdig/packetHandling.c",
-		"ntpdig/packetProcessing.c",
+		"ntpdig/key_file.c",
+		"ntpdig/kod_database.c",
+		"ntpdig/kod_file.c",
+		"ntpdig/packet_handling.c",
+		"ntpdig/packet_processing.c",
 		"ntpdig/utilities.c",
 	] + common_source
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/da0cfa0f701f61cfc0890f61f2ec1cb82791d084...99d9a0bed82cb02406ed83b6bb6fab69edbd3bc1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151205/1f6d6241/attachment.html>


More information about the vc mailing list