[Git][NTPsec/ntpsec][master] tests: add test for libparse.ieee754io. Just a skeleton.

Gary E. Miller gitlab at mg.gitlab.com
Tue Apr 4 05:51:57 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
6077bf19 by Gary E. Miller at 2017-04-03T22:51:11-07:00
tests: add test for libparse.ieee754io.  Just a skeleton.

- - - - -


3 changed files:

- tests/common/tests_main.c
- + tests/libparse/ieee754io.c
- tests/wscript


Changes:

=====================================
tests/common/tests_main.c
=====================================
--- a/tests/common/tests_main.c
+++ b/tests/common/tests_main.c
@@ -62,6 +62,10 @@ static void RunAllTests(void)
 	RUN_TEST_GROUP(ymd2yd);
 #endif
 
+#ifdef TEST_LIBPARSE
+	RUN_TEST_GROUP(ieee754io);
+#endif
+
 #ifdef TEST_NTPD
 	RUN_TEST_GROUP(leapsec);
 	RUN_TEST_GROUP(hackrestrict);


=====================================
tests/libparse/ieee754io.c
=====================================
--- /dev/null
+++ b/tests/libparse/ieee754io.c
@@ -0,0 +1,37 @@
+#include "config.h"
+#include "ntp_stdlib.h"
+#include "ntp_fp.h"
+#include "ieee754io.h"
+#include "timespecops.h"
+
+#include "unity.h"
+#include "unity_fixture.h"
+
+TEST_GROUP(ieee754io);
+
+TEST_SETUP(ieee754io) {}
+
+TEST_TEAR_DOWN(ieee754io) {}
+
+static offsets_t native_off = { 0, 1, 2, 3, 4, 5, 6, 7 };
+
+TEST(ieee754io, test_one) {
+        int ret;
+        unsigned char one[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+	unsigned char *bp = &one[0];
+        l_fp fp;
+
+        printf("hello\n");
+	ret = fetch_ieee754( &bp, IEEE_DOUBLE, &fp,
+            native_off);
+
+        printf("hello\n");
+        printf("%ld\n", (long)fp);
+
+	TEST_ASSERT( IEEE_OK == ret);
+	TEST_ASSERT_EQUAL_INT64( 0, (long)fp );
+}
+
+TEST_GROUP_RUNNER(ieee754io) {
+	RUN_TEST_CASE(ieee754io, test_one);
+}


=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -63,6 +63,26 @@ def build(ctx):
         source=libntp_source,
     )
 
+    # libparse/
+    libparse_source = [
+        "libparse/ieee754io.c",
+    ] + common_source
+
+    ctx.ntp_test(
+        defines=unity_config + ["TEST_LIBPARSE=1"],
+        features="c cprogram bld_include src_include test",
+        includes=["%s/tests/unity/" % srcnode,
+                  "%s/tests/libparse/" % srcnode,
+                  "%s/tests/common/" % srcnode
+                  ] + ctx.env.PLATFORM_INCLUDES,
+        install_path=None,
+        lib=["parse"],
+        libpath=["libparse"],
+        source=libparse_source,
+        target="test_libparse",
+        use="unity ntp isc parse M PTHREAD CRYPTO RT SOCKET NSL",
+    )
+
     ntpd_source = [
 #        "ntpd/filegen.c",
         "ntpd/leapsec.c",



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/6077bf19ff2f181acf52f5420611834c95e7d39e
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170404/008e9efe/attachment.html>


More information about the vc mailing list