int IsEqual(const l_fp expected, const l_fp actual);
-int IsEqual(const l_fp expected, const l_fp actual) {
- if (L_ISEQU(&expected, &actual)) {
- return TRUE;
- } else {
- //printf(" expected: ...");
- /*
- << " expected: " << lfptoa(&expected, FRACTION_PREC)
- << " (" << expected.l_ui << "." << expected.l_uf << ")"
- << " but was: " << lfptoa(&actual, FRACTION_PREC)
- << " (" << actual.l_ui << "." << actual.l_uf << ")";
- */
- return FALSE;
- }
-
-}
-
#endif
#include <stdio.h>
#include "config.h"
#include "ntp_stdlib.h"
+#include "ntp_calendar.h"
#include "sockaddrtest.h"
//=======External Functions This Runner Calls=====
{
progname = argv[0];
UnityBegin("lfptostr.c");
- RUN_TEST(test_PositiveInteger, 23);
- RUN_TEST(test_NegativeInteger, 24);
- RUN_TEST(test_PositiveIntegerWithFraction, 25);
- RUN_TEST(test_NegativeIntegerWithFraction, 26);
- RUN_TEST(test_RoundingDownToInteger, 27);
- RUN_TEST(test_RoundingMiddleToInteger, 28);
- RUN_TEST(test_RoundingUpToInteger, 29);
- RUN_TEST(test_SingleDecimal, 30);
- RUN_TEST(test_MillisecondsRoundingUp, 31);
- RUN_TEST(test_MillisecondsRoundingDown, 32);
- RUN_TEST(test_UnsignedInteger, 33);
+ RUN_TEST(test_PositiveInteger, 24);
+ RUN_TEST(test_NegativeInteger, 25);
+ RUN_TEST(test_PositiveIntegerWithFraction, 26);
+ RUN_TEST(test_NegativeIntegerWithFraction, 27);
+ RUN_TEST(test_RoundingDownToInteger, 28);
+ RUN_TEST(test_RoundingMiddleToInteger, 29);
+ RUN_TEST(test_RoundingUpToInteger, 30);
+ RUN_TEST(test_SingleDecimal, 31);
+ RUN_TEST(test_MillisecondsRoundingUp, 32);
+ RUN_TEST(test_MillisecondsRoundingDown, 33);
+ RUN_TEST(test_UnsignedInteger, 34);
return (UnityEnd());
}
#include <stdio.h>
#include "config.h"
#include "ntp_stdlib.h"
-#include "ntp_calendar.h"
#include "sockaddrtest.h"
//=======External Functions This Runner Calls=====
{
progname = argv[0];
UnityBegin("socktoa.c");
- RUN_TEST(test_IPv4AddressWithPort, 10);
- RUN_TEST(test_IPv6AddressWithPort, 11);
- RUN_TEST(test_ScopedIPv6AddressWithPort, 12);
- RUN_TEST(test_HashEqual, 13);
- RUN_TEST(test_HashNotEqual, 14);
- RUN_TEST(test_IgnoreIPv6Fields, 15);
+ RUN_TEST(test_IPv4AddressWithPort, 9);
+ RUN_TEST(test_IPv6AddressWithPort, 10);
+ RUN_TEST(test_ScopedIPv6AddressWithPort, 11);
+ RUN_TEST(test_HashEqual, 12);
+ RUN_TEST(test_HashNotEqual, 13);
+ RUN_TEST(test_IgnoreIPv6Fields, 14);
return (UnityEnd());
}
check_PROGRAMS = \
test-leapsec \
- test-rc_cmdlength \
+ test-rc_cmdlength \
test-ntp_scanner \
$(NULL)
+# test-ntp_signd \ #doesn't work, can't link it because you can't link static function
+
if GTEST_AVAILABLE
check_PROGRAMS += tests
else
$(NULL)
test_ntp_signd_LDADD = \
+ $(unity_tests_LDADD) \
$(top_builddir)/ntpd/libntpd.a \
+ $(top_builddir)/ntpd/ntp_signd.o \
$(unity_tests_LDADD) \
$(NULL)
test_ntp_scanner_LDADD = \
$(unity_tests_LDADD) \
+ $(top_builddir)/ntpd/ntp_scanner.o \
$(NULL)
test_ntp_scanner_SOURCES = \
- ntp_scanner.c \
+ ntp_scanner.c \
run-ntp_scanner.c \
- $(srcdir)/../libntp/test-libntp.c \
+ $(srcdir)/../libntp/test-libntp.c \
$(NULL)
$(srcdir)/run-ntp_scanner.c: $(srcdir)/ntp_scanner.c $(std_unity_list)
/* ntp_keyword.h declares finite state machine and token text */
//#include "ntp_keyword.h"
+void test_keywordIncorrectToken(void);
+void test_keywordServerToken(void);
+void test_DropUninitializedStack(void);
+void test_IncorrectlyInitializeLexStack(void);
+void test_InitializeLexStack(void);
+
+
void test_keywordIncorrectToken(void){
char * temp = keyword(999);
- printf("%s",temp);
+ //printf("%s\n",temp);
+ TEST_ASSERT_EQUAL_STRING("(keyword not found)",temp);
}
void test_keywordServerToken(void){
char * temp = keyword(401);
- printf("%s",temp); //143 or 401 ?
+ //printf("%s",temp); //143 or 401 ?
+ TEST_ASSERT_EQUAL_STRING("server",temp);
+}
+
+void test_DropUninitializedStack(void){
+ lex_drop_stack();
+}
+
+void test_IncorrectlyInitializeLexStack(void){
+
+ TEST_ASSERT_FALSE(lex_init_stack(NULL,NULL));
+ lex_drop_stack();
+}
+void test_InitializeLexStack(void){
+
+ //Some sort of server is required for this to work.
+ //sockaddr_u * remote_addr
+ //char origin[128];
+ //snprintf(origin, sizeof(origin), "remote config from %s", stoa(remote_addr));
+ //TEST_ASSERT_TRUE(lex_init_stack(origin,NULL)); //path, mode -> NULL is ok!
+ lex_drop_stack();
}
#include "unity.h"
#include <setjmp.h>
#include <stdio.h>
+#include "config.h"
+#include "ntp.h"
+#include "ntp_calendar.h"
+#include "ntp_stdlib.h"
+#include "ntp_leapsec.h"
+#include "test-libntp.h"
+#include <string.h>
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
-void resetTest(void);
extern void test_ValidateGood(void);
extern void test_ValidateNoHash(void);
extern void test_ValidateBad(void);
//=======Test Reset Option=====
-void resetTest()
+void resetTest(void);
+void resetTest(void)
{
tearDown();
setUp();
int main(int argc, char *argv[])
{
progname = argv[0];
- Unity.TestFile = "leapsec.c";
UnityBegin("leapsec.c");
RUN_TEST(test_ValidateGood, 331);
RUN_TEST(test_ValidateNoHash, 338);
extern void tearDown(void);
extern void test_keywordIncorrectToken(void);
extern void test_keywordServerToken(void);
+extern void test_DropUninitializedStack(void);
+extern void test_IncorrectlyInitializeLexStack(void);
+extern void test_InitializeLexStack(void);
//=======Test Reset Option=====
progname = argv[0];
UnityBegin("ntp_scanner.c");
RUN_TEST(test_keywordIncorrectToken, 20);
- RUN_TEST(test_keywordServerToken, 25);
+ RUN_TEST(test_keywordServerToken, 21);
+ RUN_TEST(test_DropUninitializedStack, 22);
+ RUN_TEST(test_IncorrectlyInitializeLexStack, 23);
+ RUN_TEST(test_InitializeLexStack, 24);
return (UnityEnd());
}
{
progname = argv[0];
UnityBegin("ntp_signd.c");
- RUN_TEST(test_ux_socket_connect, 13);
- RUN_TEST(test_write_all, 24);
+ RUN_TEST(test_ux_socket_connect, 12);
+ RUN_TEST(test_write_all, 23);
return (UnityEnd());
}
#include "unity.h"
#include <setjmp.h>
#include <stdio.h>
+#include "config.h"
+#include "ntp.h"
+#include "ntp_calendar.h"
+#include "ntp_stdlib.h"
+#include "test-libntp.h"
+#include <string.h>
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
-void resetTest(void);
extern void test_EvaluateCommandLength(void);
//=======Test Reset Option=====
-void resetTest()
+void resetTest(void);
+void resetTest(void)
{
tearDown();
setUp();
int main(int argc, char *argv[])
{
progname = argv[0];
- Unity.TestFile = "rc_cmdlength.c";
UnityBegin("rc_cmdlength.c");
RUN_TEST(test_EvaluateCommandLength, 15);