Qt?????????
???????????? ???????[ 2013/7/23 15:44:13 ] ????????
????QTestLib ??????????????????????????????????????????Qt+=testlib?????????????????
#include <QtTest/QtTest>
class TestQString: public QObject
{
Q_OBJECT
private slots:
// ???private slot???????????????????????
void testToLower();
// ??“_data”??β???????????????????????????
void testToLower_data();
};
void TestQString::testToLower()
{
// ???????????
QFETCH(QString?? string);
QFETCH(QString?? result);
// ??????????????????????????????????
QCOMPARE(string.toLower()?? result);
}
void TestQString::testToLower_data()
{
// ?????????
QTest::addColumn<QString>("string");
QTest::addColumn<QString>("result");
// ??????????
QTest::newRow("lower") << "hello" << "hello";
QTest::newRow("mixed") << "HeLlO" << "hello";
QTest::newRow("upper") << "HELLO" << "hello";
}
// ???????????е???????
QTEST_MAIN(TestQString)
#include "testqstring.moc"
????????Qt???????????????????????private slot??
????initTestCase()????????????????
????cleanupTestCase()????????????????
????init()??????????????????????
????cleanup()??????????????к?????
????????????????????????????
********* Start testing of TestQString *********
Config: Using QTest library 4.5.3?? Qt 4.5.3
PASS : TestQString::initTestCase()
PASS : TestQString::testToLower()
PASS : TestQString::cleanupTestCase()
Totals: 3 passed?? 0 failed?? 0 skipped
********* Finished testing of TestQString *********
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11