[Git][NTPsec/ntpsec][master] Test simplification made possible by scalar l_fp.

Eric S. Raymond gitlab at mg.gitlab.com
Thu Jan 5 19:17:02 UTC 2017


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
9007b648 by Eric S. Raymond at 2017-01-05T14:14:56-05:00
Test simplification made possible by scalar l_fp.

- - - - -


1 changed file:

- tests/libntp/timespecops.c


Changes:

=====================================
tests/libntp/timespecops.c
=====================================
--- a/tests/libntp/timespecops.c
+++ b/tests/libntp/timespecops.c
@@ -59,18 +59,9 @@ static struct timespec timespec_init(time_t hi, long lo)
 
 static bool AssertFpClose(const l_fp m, const l_fp n, const l_fp limit)
 {
-	l_fp diff;
-
-	if (L_ISGEQ(m, n)) {
-		diff = m;
-		diff -= n;
-	} else {
-		diff = n;
-		diff -= m;
-	}
-	if (L_ISGEQ(limit, diff)) {
+	int64_t diff = m - n;
+	if ((l_fp)labs(diff) <= limit)
 		return true;
-	}
 	else {
 		printf("m_expr which is %s \nand\nn_expr which is %s\nare not close; diff=%susec\n", lfptoa(m, 10), lfptoa(n, 10), lfptoa(diff, 10));
 		return false;



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/9007b6486ca4412d14a76ea871725de77c741c1b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170105/f40f6387/attachment.html>


More information about the vc mailing list