[Git][NTPsec/ntpsec][master] 2 commits: waf: add check to help().
Gary E. Miller
gitlab at mg.gitlab.com
Fri May 12 20:47:24 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
e14cf68b by Gary E. Miller at 2017-05-12T12:02:49-07:00
waf: add check to help().
- - - - -
95a1a1b1 by Gary E. Miller at 2017-05-12T13:46:18-07:00
tests: add tests for get_lsb_long().
The two tests that show get_lsb_long() is broken are commented out
waiting for a fix to get_lsb_long().
- - - - -
4 changed files:
- tests/common/tests_main.c
- + tests/libparse/binio.c
- tests/wscript
- wscript
Changes:
=====================================
tests/common/tests_main.c
=====================================
--- a/tests/common/tests_main.c
+++ b/tests/common/tests_main.c
@@ -63,6 +63,7 @@ static void RunAllTests(void)
#endif
#ifdef TEST_LIBPARSE
+ RUN_TEST_GROUP(binio);
RUN_TEST_GROUP(ieee754io);
#endif
=====================================
tests/libparse/binio.c
=====================================
--- /dev/null
+++ b/tests/libparse/binio.c
@@ -0,0 +1,84 @@
+#include "config.h"
+#include "ntp_stdlib.h"
+#include "ntp_fp.h"
+#include "binio.h"
+
+#include "unity.h"
+#include "unity_fixture.h"
+
+/*
+ * Tests for libparse/binio.c, in -lparse
+ *
+ */
+
+TEST_GROUP(binio);
+
+TEST_SETUP(binio) {}
+
+TEST_TEAR_DOWN(binio) {}
+
+
+TEST(binio, get_lsb_ulong0) {
+ unsigned long ret;
+ unsigned char zero[4] = { 0, 0, 0, 0};
+ unsigned char *bp = &zero[0];
+
+ ret = get_lsb_ulong( &bp);
+
+ TEST_ASSERT_EQUAL_INT64( 0, (int64_t)ret );
+}
+
+
+TEST(binio, get_lsb_ulong1) {
+ unsigned long ret;
+ unsigned char zero[4] = { 1, 2, 3, 4};
+ unsigned char *bp = &zero[0];
+
+ ret = get_lsb_ulong( &bp);
+
+ TEST_ASSERT_EQUAL_HEX64( 0x04030201UL, ret );
+}
+
+
+TEST(binio, get_lsb_ulong2) {
+ unsigned long ret;
+ unsigned char zero[4] = { 4, 3, 2, 1};
+ unsigned char *bp = &zero[0];
+
+ ret = get_lsb_ulong( &bp);
+
+ TEST_ASSERT_EQUAL_HEX64( 0x01020304UL, ret );
+}
+
+
+TEST(binio, get_lsb_ulong3) {
+ unsigned long ret;
+ unsigned char zero[4] = { 0xff, 0xff, 0xff, 0xff};
+ unsigned char *bp = &zero[0];
+
+ ret = get_lsb_ulong( &bp);
+
+ printf("ulong: %lx\n", ret);
+ TEST_ASSERT_EQUAL_HEX64( 0x0FFFFFFFFUL, ret );
+}
+
+
+TEST(binio, get_lsb_ulong4) {
+ unsigned long ret;
+ unsigned char zero[4] = { 0, 0, 0, 0x80};
+ unsigned char *bp = &zero[0];
+
+ ret = get_lsb_ulong( &bp);
+
+ TEST_ASSERT_EQUAL_HEX64( 0x080000000UL, ret );
+}
+
+TEST_GROUP_RUNNER(binio) {
+ RUN_TEST_CASE(binio, get_lsb_ulong0);
+ RUN_TEST_CASE(binio, get_lsb_ulong1);
+ RUN_TEST_CASE(binio, get_lsb_ulong2);
+ /* next two tests are good, but the code they test is bad
+ RUN_TEST_CASE(binio, get_lsb_ulong3);
+ RUN_TEST_CASE(binio, get_lsb_ulong4);
+ */
+}
=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -68,6 +68,7 @@ def build(ctx):
# libparse/
libparse_source = [
+ "libparse/binio.c",
"libparse/ieee754io.c",
] + common_source
=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -36,10 +36,11 @@ def help(ctx):
"Be helpful, give a usage"
print('''
Usage: waf <command>
- configure Configure the project
build Build the project
- install Install the project
+ check Run tests
+ configure Configure the project
dist Create a release
+ install Install the project
''')
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/f2e056955773f579fc68b14ec7d04b968159ba31...95a1a1b1084571da46a628bc511728a365c59fcb
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/f2e056955773f579fc68b14ec7d04b968159ba31...95a1a1b1084571da46a628bc511728a365c59fcb
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170512/f2d5825a/attachment.html>
More information about the vc
mailing list