Files
judge/example/showcase/05-pattern-expansion.jdg
Mikhail Kornilovich 7ec3a43c7a
All checks were successful
build-dsl-smoke / Build judge (push) Successful in 12s
build-dsl-smoke / debug / clang / linux (push) Successful in 6s
build-dsl-smoke / debug / gcc / linux (push) Successful in 8s
build-dsl-smoke / release / clang / linux (push) Successful in 8s
build-dsl-smoke / release / gcc / linux (push) Successful in 6s
build-dsl-smoke / sanitized / clang / linux (push) Successful in 8s
build-dsl-smoke / sanitized / gcc / linux (push) Successful in 7s
build-dsl-smoke / debug / clang / windows (push) Successful in 13s
build-dsl-smoke / debug-valgrind / gcc / linux (push) Successful in 14s
build-dsl-smoke / release / clang / windows (push) Successful in 16s
build-dsl-smoke / debug / msvc / windows (push) Successful in 18s
build-dsl-smoke / release / msvc / windows (push) Successful in 17s
build-dsl-smoke / SUMMARY (push) Successful in 4s
Release / Build & publish (push) Successful in 48s
1. New build system
Reviewed-on: #1
2026-04-12 07:59:38 +00:00

81 lines
3.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Автогенерация тестов из файлов/папок. Покрывает четыре типовых сценария:
//
// 1. Stdio-режим с парой globs — классика: stdin из .in, stdout = .ans
// 2. Shared expected — N входов, один общий ожидаемый файл
// 3. File-mode по args — программа читает файл по аргументу
// 4. Dir-mode с input+output файлами — программа читает И пишет файлы
//
// Плейсхолдеры в `args` pattern'а:
// {input_path} — путь к input-файлу текущего теста (для glob — разный,
// для литерала — один и тот же во всех тестах)
// {output_path} — аналогично для output
// {name} — wildcard-часть имени (glob) или basename директории (dir)
// {dir} — dir-mode: полный путь к директории теста
//
// Правило режима: наличие `{input_path}` в args → input кладётся как InFile,
// а не в stdin. Наличие `{output_path}` → expected сравнивается как OutFile,
// а не stdout.
toolchains {
gcc { platforms = "linux" }
}
build "release" {
language = "c"
standard = "c11"
sources = "solution.c"
output = "solution"
profile = release
}
// 1) Классика: каждая пара (*.in, *.ans) → один тест.
// Stdin ← .in, Stdout сравнивается с .ans.
group("stdio-pair") {
weight = 0.25
pattern {
input = "tests/*.in"
output = "tests/*.ans"
}
}
// 2) Один общий expected для всех входов.
// Удобно для задач где «для любого корректного входа ответ одинаковый»
// (edge-case fuzzing) или наоборот «все некорректные входы → error»
// (смотрим на один и тот же файл с сообщением об ошибке).
group("shared-output") {
weight = 0.25
pattern {
input = "edge/*.in"
output = "edge/expected.ans" // литерал без *
}
}
// 3) Программа читает файл по аргументу командной строки, а не из stdin.
// Expander создаёт InFiles[01.in]=..., запускает `./solution 01.in`,
// сравнивает stdout программы с содержимым соответствующего .ans.
group("file-input") {
weight = 0.25
pattern {
input = "file-tests/*.in"
output = "file-tests/*.ans"
args = "{input_path}"
}
}
// 4) Программа и читает, и пишет через файлы — никакого stdin/stdout.
// Expander кладёт input в InFiles, expected в OutFiles, запускает
// `./solution in.txt out.txt` и сравнивает созданный out.txt с expected.
group("file-io") {
weight = 0.25
pattern {
dirs = "cases/*" // каждая подпапка — отдельный тест
input = "in.txt"
output = "out.txt"
args = "{input_path}" "{output_path}"
}
}