コード例 #1
0
ファイル: test_gen.cpp プロジェクト: k7-223UPP/upp
int main() {
    for (int testNumber = 3; testNumber <= 120; ++testNumber) {
        std::cout << testNumber << std::endl;

        const std::string inputFileName = GetInputFileName(testNumber);
        const std::string outputFileName = GetOutputFileName(testNumber);

        std::cout << "  " << inputFileName << " " << outputFileName << std::endl;

        std::string s, t;

        if (testNumber & 1) {
            s = GetRandString();
            t = GetRandString();
        } else {
            t = GetRandString();
            int n = t.length();
            int l = GetRandIntInRange(1, n);
            int r = GetRandIntInRange(1, n);
            if (l > r) {
                std::swap(l, r);
            }
            s = t.substr(l, r - l + 1);
        }

        std::ofstream inputFile(inputFileName);
        inputFile << s << std::endl;
        inputFile << t << std::endl;
        inputFile.close();

        std::ofstream outputFile(outputFileName);
        outputFile << GetOccurrences(s, t) << std::endl;
        outputFile.close();
    }
    return 0;
}
コード例 #2
0
void RenderingDebugger::Message::BlockAfter(std::size_t occurrences)
{
    if (GetOccurrences() >= occurrences)
        Block();
}