-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathHelloWorldUnitTest.cpp
More file actions
27 lines (24 loc) · 945 Bytes
/
HelloWorldUnitTest.cpp
File metadata and controls
27 lines (24 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <QTest>
#include <QString>
namespace UnitTests {
class HelloWorldTest : public QObject{
Q_OBJECT
private slots:
void CreateStringFromLiteral() {
auto s = QString {"Hello, World!"};
QCOMPARE(s.size(), 13);
QCOMPARE(s, "Hello, World!");
}
};
}
QTEST_MAIN(UnitTests::HelloWorldTest)
#include "HelloWorldUnitTest.moc"
// This code can produce the following output :
//
// ********* Start testing of UnitTests::HelloWorldTest *********
// Config: Using QtTest library 6.6.0, Qt 6.6.0 (arm64-little_endian-lp64 shared (dynamic) release build; by Apple LLVM 15.0.0 (clang-1500.0.40.1)), macos 14.2
// PASS : UnitTests::HelloWorldTest::initTestCase()
// PASS : UnitTests::HelloWorldTest::CreateStringFromLiteral()
// PASS : UnitTests::HelloWorldTest::cleanupTestCase()
// Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 1ms
// ********* Finished testing of UnitTests::HelloWorldTest *********