// Тесты, которые общаются через файлы, а не через stdin/stdout. // file("name") = "content" — файл кладётся в рабочую директорию теста // перед запуском программы. // outFile("name") = "content" — после запуска содержимое файла сравнивается // с ожидаемым (точное совпадение с учётом // normalize_crlf / trim_trailing_ws). toolchains { gcc { platforms = "linux" } } build "release" { language = "c" standard = "c11" sources = "solution.c" output = "solution" profile = release } normalize_crlf = true trim_trailing_ws = true group("io") { weight = 1.0 // Программа читает input.txt, пишет output.txt. test("copy") { args = "input.txt" "output.txt" file("input.txt") = "hello world\n" outFile("output.txt") = "hello world\n" } // Несколько входных и выходных файлов сразу — удобно для задач // вроде «посчитать сумму по каждой строке и записать в отдельный // файл». test("multi-file") { args = "a.txt" "b.txt" "result.txt" file("a.txt") = "1 2 3\n" file("b.txt") = "10 20 30\n" outFile("result.txt") = "11 22 33\n" } // Вложенные пути тоже работают — создаются автоматически. test("nested") { args = "data/in.txt" "data/out.txt" file("data/in.txt") = "payload\n" outFile("data/out.txt") = "PAYLOAD\n" } // Можно комбинировать с stdin/stdout и переменными окружения. test("combined") { stdin = "42\n" args = "config.ini" env("MODE") = "strict" file("config.ini") = "threshold=10\n" stdout = "ok\n" outFile("log.txt") = "processed 42\n" } }