]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Merge psp-deb1.ntp.org:/home/lokeshw24/ntp-stable-unity
authorDamir Tomic <viperus@ntp.org>
Sun, 26 Jul 2015 19:00:42 +0000 (21:00 +0200)
committerDamir Tomic <viperus@ntp.org>
Sun, 26 Jul 2015 19:00:42 +0000 (21:00 +0200)
into  ubuntu.(none):/home/viperus/Desktop/ntp-stable-unity

bk: 55b52e5aok1pKPRiWQqsdgPSr5WsEw

1  2 
tests/libntp/decodenetnum.c
tests/libntp/lfptest.h
tests/libntp/lfptostr.c
tests/libntp/netof.c
tests/libntp/octtoint.c
tests/libntp/socktoa.c
tests/libntp/strtolfp.c
tests/ntpd/Makefile.am

index 77491b8b312f105a5b4849c83230fe37cc098d8d,3f0a066f0f19e42d55f055208fc3b5ad7133aba7..15f4cabcdbd98985c4a0c762d027da555fe6a322
@@@ -1,18 -1,10 +1,17 @@@
  #include "config.h"
  #include "ntp_stdlib.h"
+ #include "ntp_calendar.h"
  #include "sockaddrtest.h"
  #include "unity.h"
  
- void
 +extern void test_IPv4AddressOnly(void);
 +extern void test_IPv4AddressWithPort(void);
 +extern void test_IPv6AddressOnly(void);
 +extern void test_IPv6AddressWithPort(void);
 +extern void test_IllegalAddress(void);
 +extern void test_IllegalCharInPort(void);
 +
+ void 
  test_IPv4AddressOnly(void) {
        const char *str = "192.0.2.1";
        sockaddr_u actual;
index 30a85f5b3f56596b17cb27036df082f68aacca26,ab815f5a0bce6c2cfa7d4b8354a1a300682ed87b..defbf5822a5ff65b8a08523cb0650e232f234835
@@@ -1,16 -1,33 +1,32 @@@
  #ifndef NTP_TESTS_LFPTEST_H
  #define NTP_TESTS_LFPTEST_H
  
 +#include "config.h"
  #include "ntp_fp.h"
  
  static const int32 HALF = -2147483647L - 1L;
  static const int32 HALF_PROMILLE_UP = 2147484; // slightly more than 0.0005
  static const int32 HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
  static const int32 QUARTER = 1073741824L;
  static const int32 QUARTER_PROMILLE_APPRX = 1073742L;
  
  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
 -
 -
index 267c3021cf7e9860dbbb0f9a1ea4afd5532673a6,b185853e69e7824220d4ba4b385439be98948899..a9875133aeca3423a0d60f7f86e5376f2f235df8
@@@ -19,22 -20,7 +20,22 @@@ static const int THREE_FOURTH = -107374
  static const int HALF_PROMILLE_UP = 2147484; // slightly more than 0.0005
  static const int HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
  
- void
 +
 +void test_PositiveInteger(void);
 +void test_NegativeInteger(void);
 +void test_PositiveIntegerWithFraction(void);
 +void test_NegativeIntegerWithFraction(void);
 +void test_RoundingDownToInteger(void);
 +void test_RoundingMiddleToInteger(void);
 +void test_RoundingUpToInteger(void);
 +void test_SingleDecimal(void);
 +void test_MillisecondsRoundingUp(void);
 +void test_MillisecondsRoundingDown(void);
 +void test_UnsignedInteger(void);
 +
 +
 +
+ void 
  test_PositiveInteger(void) {
        l_fp test = {200, 0}; // exact 200.0000000000
  
index 2fde6cc2e44859c2d0609e11f58d3aafe3b1d6a8,6a3aa42337116ea1e1855ac73cdc862432821597..1a8e52b2300c1b1d382fb57fb9b1ad506b14cf0d
@@@ -7,15 -7,8 +7,16 @@@
  
  #include "sockaddrtest.h"
  
- void test_ClassBAddress(void) {
 +
 +void test_ClassBAddress(void);
 +void test_ClassCAddress(void);
 +void test_ClassAAddress(void);
 +void test_IPv6Address(void);
 +
 +
 +
+ void 
+ test_ClassBAddress(void) {
        sockaddr_u input = CreateSockaddr4("172.16.2.1", NTP_PORT);
        sockaddr_u expected = CreateSockaddr4("172.16.0.0", NTP_PORT);
  
index 5c03d6d1b807d813b7c35931138d5a70a5c95b59,c069d68346925ea3bb369581a26f59337b3c16d0..f72d529ca3422159f37b5b1a9e86d0f9132f8954
@@@ -4,17 -4,8 +4,18 @@@
  
  #include "unity.h"
  
- void test_SingleDigit(void) {
 +
 +void test_SingleDigit(void);
 +void test_MultipleDigits(void);
 +void test_Zero(void);
 +void test_MaximumUnsigned32bit(void);
 +void test_Overflow(void);
 +void test_IllegalCharacter(void);
 +void test_IllegalDigit(void);
 +
 +
+ void 
+ test_SingleDigit(void) {
        const char* str = "5";
        u_long actual;
  
index bd4e4286b5d6060b47f298b89c197d4a6e0263cb,bd584d347682e3d2e440a669f8a002ccf4cf9929..9ce3a1e9946b732323e2ab53abb4e3075eb11e6b
@@@ -4,17 -4,11 +4,17 @@@
  #include "ntp_calendar.h"
  
  #include "unity.h"
  #include "sockaddrtest.h"
  
 +void test_IPv4AddressWithPort(void);
 +void test_IPv6AddressWithPort(void);
 +void test_ScopedIPv6AddressWithPort(void);
 +void test_HashEqual(void);
 +void test_HashNotEqual(void);
 +void test_IgnoreIPv6Fields(void);
  
- void test_IPv4AddressWithPort(void) {
+ void 
+ test_IPv4AddressWithPort(void) {
        sockaddr_u input = CreateSockaddr4("192.0.2.10", 123);
  
        TEST_ASSERT_EQUAL_STRING("192.0.2.10", socktoa(&input));
index ace04b0d1ba9a080692168aa91d80a9295e79f4d,1767f0be844ae9b92fbedc0d1f7a1ede8c0127e6..00dc2772922ceed0458ab36a2f8b5bc2b776f5dc
@@@ -8,16 -8,8 +8,17 @@@
  
  /* This file tests both atolfp and mstolfp */
  
- void test_PositiveInteger(void) {
 +void test_PositiveInteger(void);
 +void test_NegativeInteger(void);
 +void test_PositiveFraction(void);
 +void test_NegativeFraction(void);
 +void test_PositiveMsFraction(void);
 +void test_NegativeMsFraction(void);
 +void test_InvalidChars(void);
 +
 +
+ void 
+ test_PositiveInteger(void) {
        const char *str = "500";
        const char *str_ms = "500000";
  
Simple merge