|
@@ -46,6 +46,7 @@ class UtilTest:public CppUnit::TestFixture {
|
|
|
CPPUNIT_TEST(testItos);
|
|
|
CPPUNIT_TEST(testUitos);
|
|
|
CPPUNIT_TEST(testHttpGMT);
|
|
|
+ CPPUNIT_TEST(testNtoh64);
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
private:
|
|
|
|
|
@@ -85,6 +86,7 @@ public:
|
|
|
void testItos();
|
|
|
void testUitos();
|
|
|
void testHttpGMT();
|
|
|
+ void testNtoh64();
|
|
|
};
|
|
|
|
|
|
|
|
@@ -681,4 +683,17 @@ void UtilTest::testHttpGMT()
|
|
|
Util::httpGMT("Tue, 2008/10/10 23:33:33 UTC"));
|
|
|
}
|
|
|
|
|
|
+void UtilTest::testNtoh64()
|
|
|
+{
|
|
|
+ uint64_t x = 0xff00ff00ee00ee00LL;
|
|
|
+#ifdef WORDS_BIGENDIAN
|
|
|
+ CPPUNIT_ASSERT_EQUAL(x, ntoh64(x));
|
|
|
+ CPPUNIT_ASSERT_EQUAL(x, hton64(x));
|
|
|
+#else // !WORDS_BIGENDIAN
|
|
|
+ uint64_t y = 0x00ee00ee00ff00ffLL;
|
|
|
+ CPPUNIT_ASSERT_EQUAL(y, ntoh64(x));
|
|
|
+ CPPUNIT_ASSERT_EQUAL(x, hton64(y));
|
|
|
+#endif // !WORDS_BIGENDIAN
|
|
|
+}
|
|
|
+
|
|
|
} // namespace aria2
|