Skip to content

Commit

Permalink
Avoid false positives in timing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Feb 14, 2022
1 parent 9e30955 commit e53c82a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions test-suite/asianoptions.cpp
Expand Up @@ -2108,6 +2108,9 @@ test_suite* AsianOptionTest::suite(SpeedLevel speed) {
if (speed <= Fast) {
suite->add(QUANTLIB_TEST_CASE(&AsianOptionTest::testMCDiscreteArithmeticAveragePrice));
suite->add(QUANTLIB_TEST_CASE(&AsianOptionTest::testMCDiscreteGeometricAveragePriceHeston));
}

if (speed == Slow) {
suite->add(QUANTLIB_TEST_CASE(&AsianOptionTest::testMCDiscreteArithmeticAveragePriceHeston));
}

Expand Down
6 changes: 2 additions & 4 deletions test-suite/basketoption.cpp
Expand Up @@ -1052,11 +1052,10 @@ test_suite* BasketOptionTest::suite(SpeedLevel speed) {
suite->add(QUANTLIB_TEST_CASE(&BasketOptionTest::testTavellaValues));

suite->add(QUANTLIB_TEST_CASE(&BasketOptionTest::testOddSamples));
suite->add(QUANTLIB_TEST_CASE(
&BasketOptionTest::testLocalVolatilitySpreadOption));
suite->add(QUANTLIB_TEST_CASE(&BasketOptionTest::test2DPDEGreeks));

if (speed <= Fast) {
suite->add(QUANTLIB_TEST_CASE(&BasketOptionTest::testLocalVolatilitySpreadOption));
// unrolled to get different test names
suite->add(QUANTLIB_TEST_CASE([=](){ BasketOptionTest::testOneDAmericanValues( 0, 5); }));
suite->add(QUANTLIB_TEST_CASE([=](){ BasketOptionTest::testOneDAmericanValues( 5, 11); }));
Expand All @@ -1066,8 +1065,7 @@ test_suite* BasketOptionTest::suite(SpeedLevel speed) {
}

if (speed == Slow) {
suite->add(QUANTLIB_TEST_CASE(
&BasketOptionTest::testBarraquandThreeValues));
suite->add(QUANTLIB_TEST_CASE(&BasketOptionTest::testBarraquandThreeValues));
}

return suite;
Expand Down
7 changes: 5 additions & 2 deletions test-suite/forwardoption.cpp
Expand Up @@ -831,8 +831,11 @@ test_suite* ForwardOptionTest::suite(SpeedLevel speed) {
suite->add(QUANTLIB_TEST_CASE(&ForwardOptionTest::testPerformanceGreeks));
suite->add(QUANTLIB_TEST_CASE(&ForwardOptionTest::testGreeksInitialization));
suite->add(QUANTLIB_TEST_CASE(&ForwardOptionTest::testMCPrices));
suite->add(QUANTLIB_TEST_CASE(&ForwardOptionTest::testHestonAnalyticalVsMCPrices));
suite->add(QUANTLIB_TEST_CASE(&ForwardOptionTest::testHestonMCPrices));

if (speed <= Fast) {
suite->add(QUANTLIB_TEST_CASE(&ForwardOptionTest::testHestonAnalyticalVsMCPrices));
}

return suite;
}
}

0 comments on commit e53c82a

Please sign in to comment.