Add benchmark annotations to the tests

This will affect total running times simce some tests will be run multiple
times but it allows precise becnhmarking.
This commit is contained in:
Matt Williams 2012-10-27 21:37:54 +01:00
parent 856cdca604
commit d6640f64d0
5 changed files with 15 additions and 5 deletions

View File

@ -154,7 +154,9 @@ void TestAStarPathfinder::testExecute()
AStarPathfinder< RawVolume<uint8_t> > pathfinder(params);
//Execute the pathfinder.
QBENCHMARK {
pathfinder.execute();
}
//Make sure the right number of steps were created.
QCOMPARE(result.size(), static_cast<size_t>(24));

View File

@ -67,7 +67,9 @@ void TestAmbientOcclusionGenerator::testExecute()
// Calculate the ambient occlusion values
IsVoxelTransparent isVoxelTransparent;
QBENCHMARK {
calculateAmbientOcclusion(&volData, &ambientOcclusionResult, volData.getEnclosingRegion(), 32.0f, 255, isVoxelTransparent);
}
//Check the results by sampling along a line though the centre of the volume. Because
//of the two walls we added, samples in the middle are darker than those at the edge.

View File

@ -154,7 +154,9 @@ void TestCubicSurfaceExtractor::testExecute()
QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial);*/
QBENCHMARK {
testForType<MaterialDensityPair88>(mesh);
}
QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fExpectedMaterial);

View File

@ -61,7 +61,9 @@ void TestLowPassFilter::testExecute()
LowPassFilter< RawVolume<Density8>, RawVolume<Density8>, Density16 > lowPassfilter(&volData, reg, &resultVolume, reg, 5);
//Test the normal implementation
QBENCHMARK {
lowPassfilter.execute();
}
QCOMPARE(resultVolume.getVoxelAt(0,0,0), Density8(4));
QCOMPARE(resultVolume.getVoxelAt(1,1,1), Density8(21));
QCOMPARE(resultVolume.getVoxelAt(2,2,2), Density8(10));

View File

@ -160,7 +160,9 @@ void TestSurfaceExtractor::testExecute()
SurfaceMesh<PositionMaterialNormal> mesh;
//Run the test for various voxel types.
QBENCHMARK {
testForType<int8_t>(mesh);
}
QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial);