};
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;
}
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;
u_long actual;
ASSERT_TRUE(hextoint(str, &actual));
- EXPECT_EQ(4294967295, actual);
+ EXPECT_EQ(4294967295UL, actual);
}
TEST_F(hextointTest, Overflow) {
#include "lfptest.h"
class hextolfpTest : public lfptest {
+protected:
+ static const int32 HALF = -2147483648L;
+ static const int32 QUARTER = 1073741824L;
};
TEST_F(hextolfpTest, PositiveInteger) {
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));
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));
}
TEST_F(inttoaTest, BigNegativeNumber) {
- EXPECT_STREQ("-2147483648", inttoa(-2147483648));
+ EXPECT_STREQ("-2147483648", inttoa(-2147483648L));
}
TEST_F(inttoaTest, MediumNumber) {
};
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));
}
u_long actual;
ASSERT_TRUE(octtoint(str, &actual));
- EXPECT_EQ(4294967295, actual);
+ EXPECT_EQ(4294967295UL, actual);
}
TEST_F(octtointTest, Overflow) {