I am using QT Test in QT5 and noticed none of the examples in their documentation (https://doc.qt.io/qt-5/qttestlib-tutorial1-example.html#writing-a-test) used a custom (non-QT) namespace, and really not even a QT namespace was referenced.
I tried using a namespace considering that is better practice for c++, but then the tests weren't working.
Here is the first example the QT documentation provided: https://code.qt.io/cgit/qt/qtbase.git/tree/examples/qtestlib/tutorial1/testqstring.cpp?h=5.13
//! [0]
#include <QtTest/QtTest>
class TestQString: public QObject
{
Q_OBJECT
private slots:
void toUpper();
};
//! [0]
//! [1]
void TestQString::toUpper()
{
QString str = "Hello";
QCOMPARE(str.toUpper(), QString("HELLO"));
}
//! [1]
//! [2]
QTEST_MAIN(TestQString)
#include "testqstring.moc"
//! [2]
Is using namespaces I create something that should be done when using QT Test or is unnecessary?