u6a/tests/default/quines.exp

50 lines
1.5 KiB
Plaintext

##
# quines.exp - Test whether quines programs from CUAN works on this u6a build
#
# Copyright (C) 2020 CismonX <admin@cismon.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
set tool "default"
set timeout 20
puts "Downloading files..."
exec wget --quiet "http://www.eleves.ens.fr:8080/home/madore/unlambda-2.0.0.tar.gz"
puts "Extracting archive..."
exec tar -zxvf "unlambda-2.0.0.tar.gz" >& /dev/null
set pwd [ pwd ]
set quines [ glob -directory "$pwd/unlambda-2.0.0/CUAN/quine/" "*.unl" ]
foreach filename $quines {
set fp [ open $filename r ]
set data [ read $fp ]
close $fp
u6a_run "$filename" - "-p5000000" 0
match_max [ string length $data ]
expect {
-ex "$data" {
pass "$filename ok!"
}
default {
fail "$filename fails!"
}
}
u6a_stop 0
}
puts "Cleaning up..."
file delete "$pwd/unlambda-2.0.0.tar.gz"
file delete -force "$pwd/unlambda-2.0.0"