forked from qt-creator/qt-creator
PerfProfiler: Move resource counter test creation closer to test code
Change-Id: Ie4fb52d171eabfa4440ed937ea57003a152f7338 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -29,7 +29,7 @@ class PerfProfilerPlugin final : public ExtensionSystem::IPlugin
|
||||
|
||||
#if WITH_TESTS
|
||||
// addTest<PerfProfilerTraceFileTest>(); // FIXME these tests have to get rewritten
|
||||
addTest<PerfResourceCounterTest>();
|
||||
addTestCreator(createPerfResourceCounterTest);
|
||||
#endif // WITH_TESTS
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,7 @@
|
||||
#include <perfprofiler/perfresourcecounter.h>
|
||||
#include <QtTest>
|
||||
|
||||
namespace PerfProfiler {
|
||||
namespace Internal {
|
||||
namespace PerfProfiler::Internal {
|
||||
|
||||
struct SizePayload : public NoPayload
|
||||
{
|
||||
@@ -71,6 +70,22 @@ static void fill(Counter &counter, const typename Counter::Container &container,
|
||||
QCOMPARE(sum(container), 0);
|
||||
}
|
||||
|
||||
class PerfResourceCounterTest final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void testMallocFree();
|
||||
void testRandomFill();
|
||||
void testUnitSized();
|
||||
void testRandomAlternate();
|
||||
void testGuesses();
|
||||
void testNegative();
|
||||
void testInvalidId();
|
||||
void testMultiCounter();
|
||||
void testMove();
|
||||
};
|
||||
|
||||
void PerfResourceCounterTest::testMallocFree()
|
||||
{
|
||||
SizeCounter::Container intContainer;
|
||||
@@ -345,6 +360,11 @@ void PerfResourceCounterTest::testMove()
|
||||
QCOMPARE(counter.currentTotal(), 500ll);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace PerfProfiler
|
||||
QObject *createPerfResourceCounterTest()
|
||||
{
|
||||
return new PerfResourceCounterTest;
|
||||
}
|
||||
|
||||
} // PerfProfiler::Internal
|
||||
|
||||
#include "perfresourcecounter_test.moc"
|
||||
|
@@ -5,23 +5,8 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace PerfProfiler {
|
||||
namespace Internal {
|
||||
namespace PerfProfiler::Internal {
|
||||
|
||||
class PerfResourceCounterTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void testMallocFree();
|
||||
void testRandomFill();
|
||||
void testUnitSized();
|
||||
void testRandomAlternate();
|
||||
void testGuesses();
|
||||
void testNegative();
|
||||
void testInvalidId();
|
||||
void testMultiCounter();
|
||||
void testMove();
|
||||
};
|
||||
QObject *createPerfResourceCounterTest();
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace PerfProfiler
|
||||
} // PerfProfiler::Internal
|
||||
|
Reference in New Issue
Block a user