コード例 #1
0
        static void sortTests( IConfig const& config, std::vector<TestCase>& matchingTestCases ) {

            switch( config.runOrder() ) {
                case RunTests::InLexicographicalOrder:
                    std::sort( matchingTestCases.begin(), matchingTestCases.end(), LexSort() );
                    break;
                case RunTests::InRandomOrder:
                {
                    RandomNumberGenerator rng;
                    std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng );
                }
                    break;
                case RunTests::InDeclarationOrder:
                    // already in declaration order
                    break;
            }
        }
コード例 #2
0
    inline std::vector<TestCase> sortTests(IConfig const &config, std::vector<TestCase> const &unsortedTestCases) {

        std::vector<TestCase> sorted = unsortedTestCases;

        switch (config.runOrder()) {
            case RunTests::InLexicographicalOrder:
                std::sort(sorted.begin(), sorted.end(), LexSort());
                break;
            case RunTests::InRandomOrder: {
                seedRng(config);

                RandomNumberGenerator rng;
                std::random_shuffle(sorted.begin(), sorted.end(), rng);
            }
                break;
            case RunTests::InDeclarationOrder:
                // already in declaration order
                break;
        }
        return sorted;
    }