]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Cleanups, fixed some warnings issued when compiling on psp-deb1.
authorLinux Karlsson <karlsson@ntp.org>
Thu, 17 Jun 2010 11:44:17 +0000 (13:44 +0200)
committerLinux Karlsson <karlsson@ntp.org>
Thu, 17 Jun 2010 11:44:17 +0000 (13:44 +0200)
bk: 4c1a0a91OqxlX54g0YNRZl4N024xxQ

tests/libntp/caljulian.cpp
tests/libntp/hextoint.cpp
tests/libntp/hextolfp.cpp
tests/libntp/inttoa.cpp
tests/libntp/numtoa.cpp
tests/libntp/octtoint.cpp

index 9ff54dfbe70b8510c51952c90dd486b7dad483e3..2b68b59ccdf217744ff648fc881e831664fb9c36 100644 (file)
@@ -35,7 +35,7 @@ protected:
 };
 
 TEST_F(caljulianTest, RegularTime) {
-       u_long testDate = 3485080800; // 2010-06-09 14:00:00
+       u_long testDate = 3485080800UL; // 2010-06-09 14:00:00
        calendar expected = {2010,160,6,9,14,0,0};
 
        calendar actual;
@@ -46,7 +46,7 @@ TEST_F(caljulianTest, RegularTime) {
 }
 
 TEST_F(caljulianTest, uLongBoundary) {
-       u_long time = 4294967295; // 2036-02-07 6:28:15
+       u_long time = 4294967295UL; // 2036-02-07 6:28:15
        calendar expected = {2036,0,2,7,6,28,15};
 
        calendar actual;
index 6b8e0595b66ae3236aae017a509ee2d7d8ee3d2c..54c9a67aa149196dae79e4d92bc529b83853b6ee 100644 (file)
@@ -24,7 +24,7 @@ TEST_F(hextointTest, MaxUnsigned) {
        u_long actual;
 
        ASSERT_TRUE(hextoint(str, &actual));
-       EXPECT_EQ(4294967295, actual);
+       EXPECT_EQ(4294967295UL, actual);
 }
 
 TEST_F(hextointTest, Overflow) {
index f99fc4385e6a97bd0fefc9c121494d93303d5012..f1d02125eb42017df42c94fd4995362492b47697 100644 (file)
@@ -1,6 +1,9 @@
 #include "lfptest.h"
 
 class hextolfpTest : public lfptest {
+protected:
+       static const int32 HALF = -2147483648L;
+       static const int32 QUARTER = 1073741824L;
 };
 
 TEST_F(hextolfpTest, PositiveInteger) {
@@ -27,7 +30,7 @@ TEST_F(hextolfpTest, PositiveFraction) {
        const char *str = "00002000.80000000"; // 8196.5 decimal
        l_fp actual;
 
-       l_fp expected = {8192, -2147483648};
+       l_fp expected = {8192, HALF};
 
        ASSERT_TRUE(hextolfp(str, &actual));
        EXPECT_TRUE(IsEqual(expected, actual));
@@ -37,7 +40,7 @@ TEST_F(hextolfpTest, NegativeFraction) {
        const char *str = "ffffffff.40000000"; // -1 + 0.25 decimal
        l_fp actual;
 
-       l_fp expected = {-1, 1073741824}; //-1 + 0.25
+       l_fp expected = {-1, QUARTER}; //-1 + 0.25
 
        ASSERT_TRUE(hextolfp(str, &actual));
        EXPECT_TRUE(IsEqual(expected, actual));
index 01ab3227f69de0680433a0ed532b417895669a9f..8d7510bd6013f79d6468863c615772f80d2c314b 100644 (file)
@@ -17,7 +17,7 @@ TEST_F(inttoaTest, BigPositiveNumber) {
 }
 
 TEST_F(inttoaTest, BigNegativeNumber) {
-       EXPECT_STREQ("-2147483648", inttoa(-2147483648));
+       EXPECT_STREQ("-2147483648", inttoa(-2147483648L));
 }
 
 TEST_F(inttoaTest, MediumNumber) {
index 06a5df4ce0bd2ef561b6f5740443109278404601..58e00c4c27ec656e7d393212af46af26694081bf 100644 (file)
@@ -4,14 +4,15 @@ class numtoaTest : public libntptest {
 };
 
 TEST_F(numtoaTest, Address) {
-       u_int32 input = htonl(3221225472+512+1); // 192.0.2.1
+       u_int32 input = htonl(3221225472UL+512UL+1UL); // 192.0.2.1
 
        EXPECT_STREQ("192.0.2.1", numtoa(input));
 }
 
 TEST_F(numtoaTest, Netmask) {
        // 255.255.255.0
-       u_int32 input = htonl(255*256*256*256 + 255*256*256 + 255*256);
+       u_int32 hostOrder = 255UL*256UL*256UL*256UL + 255UL*256UL*256UL + 255UL*256UL;
+       u_int32 input = htonl(hostOrder);
 
        EXPECT_STREQ("255.255.255.0", numtoa(input));
 }
index f88ffff1ecb2c3b0b72f9cbd141b06ef19e6c716..14a993e035a19b6775f5024d75ec69880422dd11 100644 (file)
@@ -32,7 +32,7 @@ TEST_F(octtointTest, MaximumUnsigned32bit) {
        u_long actual;
 
        ASSERT_TRUE(octtoint(str, &actual));
-       EXPECT_EQ(4294967295, actual);
+       EXPECT_EQ(4294967295UL, actual);
 }
 
 TEST_F(octtointTest, Overflow) {