[Git][NTPsec/ntpsec][master] Unit test fot l_fp extraction fumctions.
Eric S. Raymond
gitlab at mg.gitlab.com
Tue Jan 3 16:03:25 UTC 2017
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
8c2dfdc7 by Eric S. Raymond at 2017-01-03T11:03:12-05:00
Unit test fot l_fp extraction fumctions.
- - - - -
1 changed file:
- tests/libntp/lfpfunc.c
Changes:
=====================================
tests/libntp/lfpfunc.c
=====================================
--- a/tests/libntp/lfpfunc.c
+++ b/tests/libntp/lfpfunc.c
@@ -216,6 +216,23 @@ eps(double d)
}
//----------------------------------------------------------------------
+// test extractor functions
+//----------------------------------------------------------------------
+
+TEST(lfpfunc, Extraction) {
+ const uint32_t hi = 0xFFEEDDBB;
+ const uint32_t lo = 0x66554433;
+ l_fp lfp = lfpinit(hi, lo);
+ TEST_ASSERT_EQUAL(lfpuint(lfp), hi);
+ TEST_ASSERT_EQUAL(lfpfrac(lfp), lo);
+ TEST_ASSERT_EQUAL(lfpsint(lfp), -1122885);
+ l_fp bumpable = lfpinit(333, 444);
+ bumplfpuint(bumpable, 1);
+ TEST_ASSERT_EQUAL(lfpuint(bumpable), 334);
+ TEST_ASSERT_EQUAL(lfpfrac(bumpable), 444);
+}
+
+//----------------------------------------------------------------------
// test addition
//----------------------------------------------------------------------
TEST(lfpfunc, AdditionLR) {
@@ -453,6 +470,7 @@ TEST(lfpfunc, UnsignedRelOps) {
//----------------------------------------------------------------------
TEST_GROUP_RUNNER(lfpfunc) {
+ RUN_TEST_CASE(lfpfunc, Extraction);
RUN_TEST_CASE(lfpfunc, AdditionLR);
RUN_TEST_CASE(lfpfunc, AdditionRL);
RUN_TEST_CASE(lfpfunc, SubtractionLR);
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/8c2dfdc7bd6ba7cc5f87974e19a8ba955a1c2dde
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170103/42c01e82/attachment.html>
More information about the vc
mailing list