mirror of https://github.com/aria2/aria2
2010-10-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added test cases for util::parseUIntNoThrow() and util::parseLLIntNoThrow(). * test/UtilTest.ccpull/1/head
parent
1505671e7b
commit
788679f0df
|
@ -1,3 +1,9 @@
|
||||||
|
2010-10-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Added test cases for util::parseUIntNoThrow() and
|
||||||
|
util::parseLLIntNoThrow().
|
||||||
|
* test/UtilTest.cc
|
||||||
|
|
||||||
2010-10-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-10-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Use util::strip() instead of util::trim()
|
Use util::strip() instead of util::trim()
|
||||||
|
|
|
@ -46,6 +46,8 @@ class UtilTest:public CppUnit::TestFixture {
|
||||||
CPPUNIT_TEST(testParseUInt);
|
CPPUNIT_TEST(testParseUInt);
|
||||||
CPPUNIT_TEST(testParseLLInt);
|
CPPUNIT_TEST(testParseLLInt);
|
||||||
CPPUNIT_TEST(testParseULLInt);
|
CPPUNIT_TEST(testParseULLInt);
|
||||||
|
CPPUNIT_TEST(testParseUIntNoThrow);
|
||||||
|
CPPUNIT_TEST(testParseLLIntNoThrow);
|
||||||
CPPUNIT_TEST(testToString_binaryStream);
|
CPPUNIT_TEST(testToString_binaryStream);
|
||||||
CPPUNIT_TEST(testItos);
|
CPPUNIT_TEST(testItos);
|
||||||
CPPUNIT_TEST(testUitos);
|
CPPUNIT_TEST(testUitos);
|
||||||
|
@ -100,6 +102,8 @@ public:
|
||||||
void testParseUInt();
|
void testParseUInt();
|
||||||
void testParseLLInt();
|
void testParseLLInt();
|
||||||
void testParseULLInt();
|
void testParseULLInt();
|
||||||
|
void testParseUIntNoThrow();
|
||||||
|
void testParseLLIntNoThrow();
|
||||||
void testToString_binaryStream();
|
void testToString_binaryStream();
|
||||||
void testItos();
|
void testItos();
|
||||||
void testUitos();
|
void testUitos();
|
||||||
|
@ -753,6 +757,26 @@ void UtilTest::testParseULLInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UtilTest::testParseUIntNoThrow()
|
||||||
|
{
|
||||||
|
uint32_t n;
|
||||||
|
CPPUNIT_ASSERT(util::parseUIntNoThrow(n, " 4294967295 "));
|
||||||
|
CPPUNIT_ASSERT_EQUAL((uint32_t)UINT32_MAX, n);
|
||||||
|
CPPUNIT_ASSERT(!util::parseUIntNoThrow(n, "4294967296"));
|
||||||
|
CPPUNIT_ASSERT(!util::parseUIntNoThrow(n, "-1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UtilTest::testParseLLIntNoThrow()
|
||||||
|
{
|
||||||
|
int64_t n;
|
||||||
|
CPPUNIT_ASSERT(util::parseLLIntNoThrow(n, " 9223372036854775807 "));
|
||||||
|
CPPUNIT_ASSERT_EQUAL((int64_t)INT64_MAX, n);
|
||||||
|
CPPUNIT_ASSERT(!util::parseLLIntNoThrow(n, "9223372036854775808"));
|
||||||
|
CPPUNIT_ASSERT(util::parseLLIntNoThrow(n, "-9223372036854775808"));
|
||||||
|
CPPUNIT_ASSERT_EQUAL((int64_t)INT64_MIN, n);
|
||||||
|
CPPUNIT_ASSERT(!util::parseLLIntNoThrow(n, "-9223372036854775809"));
|
||||||
|
}
|
||||||
|
|
||||||
void UtilTest::testToString_binaryStream()
|
void UtilTest::testToString_binaryStream()
|
||||||
{
|
{
|
||||||
SharedHandle<DiskWriter> dw(new ByteArrayDiskWriter());
|
SharedHandle<DiskWriter> dw(new ByteArrayDiskWriter());
|
||||||
|
|
Loading…
Reference in New Issue