]> granicus.if.org Git - taglib/commitdiff
Add some tests for String::toInt() with too large values.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Thu, 19 Nov 2015 05:52:02 +0000 (14:52 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Thu, 19 Nov 2015 05:52:02 +0000 (14:52 +0900)
tests/test_string.cpp

index afb2aa2396befaee2be146ce1ff44316c04eed2b..68a14ed99da145c8368e01de4d9d2154b2784be6 100644 (file)
@@ -241,6 +241,12 @@ public:
     CPPUNIT_ASSERT_EQUAL(String("-123").toInt(), -123);
     CPPUNIT_ASSERT_EQUAL(String("123aa").toInt(), 123);
     CPPUNIT_ASSERT_EQUAL(String("-123aa").toInt(), -123);
+
+    String("2147483648").toInt(&ok);
+    CPPUNIT_ASSERT_EQUAL(ok, false);
+
+    String("-2147483649").toInt(&ok);
+    CPPUNIT_ASSERT_EQUAL(ok, false);
   }
 
   void testSubstr()