x(i) = 1;
end
testCase.stopMeasuring
testCase.verifyNumElements(x,1e5)
end
end
end
Run PreallocationTest as a performance test. Three tests are filtered because the
measurements are too close to the precision of the framework.
results = runperf('PreallocationTest');
Running PreallocationTest
........
PreallocationTest/testOnes was filtered.
Test Diagnostic: The MeasuredTime should not be too close to the precision of the framework.
Details
.. ......
PreallocationTest/testIndexingWithVariable was filtered.
Test Diagnostic: The MeasuredTime should not be too close to the precision of the framework.
Details
.... ....
PreallocationTest/testIndexingOnLHS was filtered.
Test Diagnostic: The MeasuredTime should not be too close to the precision of the framework.
Details
...... ..
Done PreallocationTest
Failure Summary:
Name Failed Incomplete Reason(s)
PreallocationTest/testOnes X Filtered by assumption.
PreallocationTest/testIndexingWithVariable X Filtered by assumption.
PreallocationTest/testIndexingOnLHS X Filtered by assumption.
To instruct the framework to automatically loop through the measured code and average
the measurement results, modify PreallocationTest to use a keepMeasuring-while
loop instead of startMeasuring and stopMeasuring.
classdef PreallocationTest < matlab.perftest.TestCase
methods(Test)
function testOnes(testCase)
while(testCase.keepMeasuring)
Measure Fast Executing Test Code