Commit 96a0c301 authored by Greg Knight's avatar Greg Knight

add testFromInt to fail if GooString::fromInt is broken again

parent 903983bb
......@@ -14,6 +14,7 @@ private slots:
void testInsert();
void testFormat();
void testFromNullptr();
void testFromInt();
};
void TestGooString::testInsertData_data()
......@@ -161,6 +162,25 @@ void TestGooString::testFromNullptr()
}
}
void TestGooString::testFromInt()
{
struct _testcase {
int inty;
const char* str;
} cases[] = {
{ 12345, "12345" },
{ -1, "-1" },
{ 0, "0" },
{ 0x7fffffff, "2147483647" },
{ -0x7fffffff - 1, "-2147483648" },
};
for (size_t k = 0; k < sizeof(cases) / sizeof(cases[0]); ++k) {
QScopedPointer<GooString> str(GooString::fromInt(cases[k].inty));
QCOMPARE(str->c_str(), cases[k].str);
}
}
QTEST_GUILESS_MAIN(TestGooString)
#include "check_goostring.moc"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment