mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 09:20:48 +02:00
tweaks to unit tests
This commit is contained in:
parent
441a345864
commit
bf0171700a
1 changed files with 19 additions and 15 deletions
|
@ -176,13 +176,13 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
|
|
||||||
{
|
{
|
||||||
testsTaken++;
|
testsTaken++;
|
||||||
QString testName = "Performance - findClosestModel() 1,000,000 times";
|
const int TEST_ITERATIONS = 1000;
|
||||||
|
QString testName = "Performance - findClosestModel() "+ QString::number(TEST_ITERATIONS) + " times";
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
qDebug() << "Test" << testsTaken <<":" << qPrintable(testName);
|
qDebug() << "Test" << testsTaken <<":" << qPrintable(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
float targetRadius = oneMeter * 2.0 / (float)TREE_SCALE; // in tree units
|
float targetRadius = oneMeter * 2.0 / (float)TREE_SCALE; // in tree units
|
||||||
const int TEST_ITERATIONS = 1000000;
|
|
||||||
quint64 start = usecTimestampNow();
|
quint64 start = usecTimestampNow();
|
||||||
const ModelItem* foundModelByRadius = NULL;
|
const ModelItem* foundModelByRadius = NULL;
|
||||||
for (int i = 0; i < TEST_ITERATIONS; i++) {
|
for (int i = 0; i < TEST_ITERATIONS; i++) {
|
||||||
|
@ -208,12 +208,12 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
|
|
||||||
{
|
{
|
||||||
testsTaken++;
|
testsTaken++;
|
||||||
QString testName = "Performance - findModelByID() 1,000,000 times";
|
const int TEST_ITERATIONS = 1000;
|
||||||
|
QString testName = "Performance - findModelByID() "+ QString::number(TEST_ITERATIONS) + " times";
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
qDebug() << "Test" << testsTaken <<":" << qPrintable(testName);
|
qDebug() << "Test" << testsTaken <<":" << qPrintable(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int TEST_ITERATIONS = 1000000;
|
|
||||||
quint64 start = usecTimestampNow();
|
quint64 start = usecTimestampNow();
|
||||||
const ModelItem* foundModelByID = NULL;
|
const ModelItem* foundModelByID = NULL;
|
||||||
for (int i = 0; i < TEST_ITERATIONS; i++) {
|
for (int i = 0; i < TEST_ITERATIONS; i++) {
|
||||||
|
@ -242,7 +242,7 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
srand(0xFEEDBEEF);
|
srand(0xFEEDBEEF);
|
||||||
|
|
||||||
testsTaken++;
|
testsTaken++;
|
||||||
const int TEST_ITERATIONS = 10000;
|
const int TEST_ITERATIONS = 1000;
|
||||||
QString testName = "Performance - add model to tree " + QString::number(TEST_ITERATIONS) + " times";
|
QString testName = "Performance - add model to tree " + QString::number(TEST_ITERATIONS) + " times";
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
qDebug() << "Test" << testsTaken <<":" << qPrintable(testName);
|
qDebug() << "Test" << testsTaken <<":" << qPrintable(testName);
|
||||||
|
@ -308,7 +308,7 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Every 1000th test, show the size of the tree...
|
// Every 1000th test, show the size of the tree...
|
||||||
if (verbose && (i % 1000 == 0)) {
|
if (extraVerbose && (i % 1000 == 0)) {
|
||||||
qDebug() << "after test:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
|
qDebug() << "after test:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,10 +316,12 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
if (passed) {
|
if (passed) {
|
||||||
iterationsPassed++;
|
iterationsPassed++;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "FAILED - Test" << testsTaken <<":" << qPrintable(testName) << "iteration:" << i
|
if (extraVerbose) {
|
||||||
<< "foundModelByRadius=" << foundModelByRadius << "foundModelByID=" << foundModelByID
|
qDebug() << "FAILED - Test" << testsTaken <<":" << qPrintable(testName) << "iteration:" << i
|
||||||
<< "x/y/z=" << randomX << "," << randomY << "," << randomZ
|
<< "foundModelByRadius=" << foundModelByRadius << "foundModelByID=" << foundModelByID
|
||||||
<< "elementIsBestFit=" << elementIsBestFit;
|
<< "x/y/z=" << randomX << "," << randomY << "," << randomZ
|
||||||
|
<< "elementIsBestFit=" << elementIsBestFit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +346,7 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
|
|
||||||
{
|
{
|
||||||
testsTaken++;
|
testsTaken++;
|
||||||
const int TEST_ITERATIONS = 10000;
|
const int TEST_ITERATIONS = 1000;
|
||||||
QString testName = "Performance - delete model from tree " + QString::number(TEST_ITERATIONS) + " times";
|
QString testName = "Performance - delete model from tree " + QString::number(TEST_ITERATIONS) + " times";
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
qDebug() << "Test" << testsTaken <<":" << qPrintable(testName);
|
qDebug() << "Test" << testsTaken <<":" << qPrintable(testName);
|
||||||
|
@ -384,7 +386,7 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Every 1000th test, show the size of the tree...
|
// Every 1000th test, show the size of the tree...
|
||||||
if (verbose && (i % 1000 == 0)) {
|
if (extraVerbose && (i % 1000 == 0)) {
|
||||||
qDebug() << "after test:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
|
qDebug() << "after test:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,9 +394,11 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
if (passed) {
|
if (passed) {
|
||||||
iterationsPassed++;
|
iterationsPassed++;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "FAILED - Test" << testsTaken <<":" << qPrintable(testName) << "iteration:" << i
|
if (extraVerbose) {
|
||||||
<< "foundModelByID=" << foundModelByID
|
qDebug() << "FAILED - Test" << testsTaken <<":" << qPrintable(testName) << "iteration:" << i
|
||||||
<< "containingElement=" << containingElement;
|
<< "foundModelByID=" << foundModelByID
|
||||||
|
<< "containingElement=" << containingElement;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue