Groupies working hard! :D
This commit is contained in:
26
A0/test.sh
26
A0/test.sh
@ -12,26 +12,28 @@ rm -f test_files/*
|
||||
|
||||
|
||||
echo "Generating test files.."
|
||||
printf "Hello, World!\n" > test_files/ascii.input
|
||||
printf "Hello, World\x04!\n" > test_files/ascii.input
|
||||
printf "Hello, World!" > test_files/ascii2.input
|
||||
printf "Test file\nTest\nThis is a test file\n\n\n\n" > test_files/ascii3.input
|
||||
printf "Hello,\x00World!\n" > test_files/data.input
|
||||
printf "Hællo,\x00World!\n" > test_files/iso1.input
|
||||
printf "Hello,\x00Wørld!\n" > test_files/iso2.input
|
||||
printf "Hello,\x00World!\n" > test_files/utf81.input
|
||||
printf "Hello,\x00World!\n" > test_files/utf82.input
|
||||
printf "Hello,\x00World!\n" > test_files/data2.input
|
||||
printf "Hello,\xa0World!\n" > test_files/iso1.input
|
||||
printf "Hello,\xa1\xbbWorld!\n" > test_files/iso2.input
|
||||
printf "Hello, \xaaWorld!\n" > test_files/iso3.input
|
||||
printf "\x24\xe0\xa4\xb9\xf0\x90\x8d\x88\n" > test_files/utf81.input
|
||||
printf "مرحبا عالمي\n" > test_files/utf82.input
|
||||
printf "Hello, World or should I say, 안녕하세요 세계!\n" > test_files/utf83.input
|
||||
printf "" > test_files/empty.input
|
||||
### TODO: Generate more test files ###
|
||||
|
||||
|
||||
echo "Running the tests.."
|
||||
exitcode=0
|
||||
for f in test_files/*.input
|
||||
for f in test_files/*.input # For loop
|
||||
do
|
||||
echo ">>> Testing ${f}.."
|
||||
file "${f}" | sed 's/ASCII text.*/ASCII text/' > "${f}.expected"
|
||||
./file "${f}" > "${f}.actual"
|
||||
echo ">>> Testing ${f}.." # print
|
||||
file "${f}" | sed 's/ASCII text.*/ASCII text/' > "${f}.expected" # fjerner tekst der kun bliver givet ved ASCII filer og gemmer svaret i ".expected" filen.
|
||||
./file "${f}" > "${f}.actual" # giver vores *egen* kodes svar i ".actual" filen.
|
||||
|
||||
if ! diff -u "${f}.expected" "${f}.actual"
|
||||
if ! diff -u "${f}.expected" "${f}.actual" # sammenligner vores egen kodes svar og "file" kommandoens svar
|
||||
then
|
||||
echo ">>> Failed :-("
|
||||
exitcode=1
|
||||
|
Reference in New Issue
Block a user