From b62a1b53341f0789f06d9a3c7dceb29a76cf9668 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 18 Sep 2014 18:24:41 +0100 Subject: [PATCH] Moved RandomNumberGenerator out of function and pass in a named instance instead of a temporary - both for C++03 compatibility reasons --- .../catch_test_case_registry_impl.hpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index 9e3ef11b..5d24b15c 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -22,6 +22,13 @@ namespace Catch { class TestRegistry : public ITestCaseRegistry { + struct LexSort { + bool operator() (TestCase i,TestCase j) const { return (i& matchingTestCases ) const { - struct LexSort { - bool operator() (TestCase i,TestCase j) const { return (i::const_iterator it = m_functionsInOrder.begin(), itEnd = m_functionsInOrder.end(); @@ -82,7 +81,10 @@ namespace Catch { std::sort( matchingTestCases.begin(), matchingTestCases.end(), LexSort() ); break; case RunTests::InRandomOrder: - std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), RandomNumberGenerator() ); + { + RandomNumberGenerator rng; + std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng ); + } break; case RunTests::InDeclarationOrder: // already in declaration order