Тааак
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Проверяем, что есть папка t/ с тестовыми файлами
|
||||||
|
if [ ! -d "t" ]; then
|
||||||
|
echo "::error::Directory 't' with test files not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
for file in t/*; do
|
for file in t/*; do
|
||||||
|
echo "------------------------------------"
|
||||||
echo "Testing with file: $file"
|
echo "Testing with file: $file"
|
||||||
|
|
||||||
# Передаём последовательный ввод
|
# Способ 1. Передавать через временный файл
|
||||||
printf "0\n$file\n" | ./a.out
|
# echo "0" > test_input.txt
|
||||||
if [ $? -ne 0 ]; then
|
# 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"
|
echo "::error::Test failed for $file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "All tests passed successfully."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue