[Git][NTPsec/ntpsec][master] Convert libntp/msyslog.c.
Amar Takhar
gitlab at mg.gitlab.com
Fri Dec 4 19:26:23 UTC 2015
Amar Takhar pushed to branch master at NTPsec / ntpsec
Commits:
fd11ac0c by Amar Takhar at 2015-12-04T14:25:45Z
Convert libntp/msyslog.c.
- - - - -
3 changed files:
- tests/common/tests_main.c
- tests/libntp/msyslog.c
- tests/wscript
Changes:
=====================================
tests/common/tests_main.c
=====================================
--- a/tests/common/tests_main.c
+++ b/tests/common/tests_main.c
@@ -52,7 +52,7 @@ static void RunAllTests(void)
// RUN_TEST_GROUP(lfp);
// RUN_TEST_GROUP(lfptostr);
RUN_TEST_GROUP(modetoa);
-// RUN_TEST_GROUP(msyslog);
+ RUN_TEST_GROUP(msyslog);
RUN_TEST_GROUP(netof);
RUN_TEST_GROUP(numtoa);
RUN_TEST_GROUP(numtohost);
=====================================
tests/libntp/msyslog.c
=====================================
--- a/tests/libntp/msyslog.c
+++ b/tests/libntp/msyslog.c
@@ -1,10 +1,8 @@
#include "config.h"
#include "ntp_stdlib.h"
-extern "C" {
#include "unity.h"
#include "unity_fixture.h"
-}
TEST_GROUP(msyslog);
@@ -13,18 +11,14 @@ TEST_SETUP(msyslog) {}
TEST_TEAR_DOWN(msyslog) {}
-extern "C" {
#include <stdio.h>
#include <string.h>
#include <errno.h>
+
#ifndef VSNPRINTF_PERCENT_M
// format_errmsg() is normally private to msyslog.c
void format_errmsg (char *, size_t, const char *, int);
#endif
-};
-
-class msyslogTest : public libntptest {
-};
// msnprintf()
TEST(msyslog, msnprintf)
@@ -88,7 +82,6 @@ TEST(msyslog, msnprintfBackslashPercent)
TEST(msyslog, msnprintfHangingPercent)
{
- static char fmt[] = "percent then nul term then non-nul %\0oops!";
char exp_buf[64];
char act_buf[64];
int exp_cnt;
@@ -96,8 +89,12 @@ TEST(msyslog, msnprintfHangingPercent)
ZERO(exp_buf);
ZERO(act_buf);
- exp_cnt = snprintf(exp_buf, sizeof(exp_buf), fmt);
- act_cnt = msnprintf(act_buf, sizeof(act_buf), fmt);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat"
+ exp_cnt = snprintf(exp_buf, sizeof(exp_buf), "percent then nul term then non-nul %\0oops!");
+ act_cnt = msnprintf(act_buf, sizeof(act_buf), "percent then nul term then non-nul %\0oops!");
+#pragma clang diagnostic pop
+
TEST_ASSERT_EQUAL(exp_cnt, act_cnt);
TEST_ASSERT_EQUAL_STRING(exp_buf, act_buf);
TEST_ASSERT_EQUAL_STRING("", act_buf + 1 + strlen(act_buf));
=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -67,7 +67,7 @@ def build(ctx):
# "libntp/lfpfunc.c",
# "libntp/lfptostr.c",
"libntp/modetoa.c",
-# "libntp/msyslog.c",
+ "libntp/msyslog.c",
"libntp/netof.c",
"libntp/numtoa.c",
"libntp/numtohost.c",
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/fd11ac0cbcfac9a0f693a9dcca1088a9cbf2fc1a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151204/19377add/attachment.html>
More information about the vc
mailing list