44 lines
1.5 KiB
Plaintext
44 lines
1.5 KiB
Plaintext
##
|
|
# square.exp - Test whether a "square" program 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 5
|
|
|
|
# The following code is a modified version of ftp://ftp.madore.org/pub/madore/unlambda/CUAN/Square.unl
|
|
# Written by Panu Kalliokoski <Panu.Kalliokoski@nokia.com>
|
|
set src_stub "`r```si`k``s``s`kk`si``s``si`k``s`k`s`k``sk``sr`k.oir``si%s`k`ki"
|
|
set src_segment ""
|
|
set expected "\n"
|
|
for { set i 0 } { $i < 20 } { incr i } {
|
|
set src_segment "$src_segment``si"
|
|
set line [ string repeat "o" [ expr $i + 1 ] ]
|
|
set square [ string repeat "$line\n" [ expr $i + 1 ] ]
|
|
set expected "$expected\n$square"
|
|
u6a_run [ format $src_stub $src_segment ] - - 0
|
|
expect {
|
|
$expected {
|
|
pass "case $i ok!"
|
|
}
|
|
default {
|
|
fail "case $i fails!"
|
|
}
|
|
}
|
|
u6a_stop 0
|
|
}
|