예제 #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();
}