Тааак
This commit is contained in:
parent
8429487f57
commit
a354c34e1d
1 changed files with 60 additions and 37 deletions
29
.github/workflows/compile-and-test.yml
vendored
29
.github/workflows/compile-and-test.yml
vendored
|
|
@ -45,13 +45,36 @@ jobs:
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Проверяем, что есть папка t/ с тестовыми файлами
|
||||
if [ ! -d "t" ]; then
|
||||
echo "::error::Directory 't' with test files not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in t/*; do
|
||||
echo "------------------------------------"
|
||||
echo "Testing with file: $file"
|
||||
|
||||
# Передаём последовательный ввод
|
||||
printf "0\n$file\n" | ./a.out
|
||||
if [ $? -ne 0 ]; then
|
||||
# Способ 1. Передавать через временный файл
|
||||
# echo "0" > test_input.txt
|
||||
# echo "$file" >> test_input.txt
|
||||
# echo "=== Test input ==="
|
||||
# cat test_input.txt
|
||||
# echo "=================="
|
||||
# ./a.out < test_input.txt
|
||||
|
||||
# Способ 2. Через printf (важно экранировать %s и $file)
|
||||
printf "0\n%s\n" "$file" | ./a.out
|
||||
# Или можно так (если хотите увидеть ввод на экране лога):
|
||||
echo -e "0\n$file\n" | ./a.out
|
||||
|
||||
status=$?
|
||||
echo "Exit code: $status"
|
||||
|
||||
if [ $status -ne 0 ]; then
|
||||
echo "::error::Test failed for $file"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All tests passed successfully."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue