ctlseqs/tests/ctlseqs/match.exp

47 lines
1.4 KiB
Plaintext

#
# Copyright (C) 2021 CismonX <admin@cismon.net>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty, provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any warranty.
#
set tool ctlseqs
set timeout 2
set n1 [ random_int ]
set n2 [ random_int ]
set n3 [ random_int ]
set n1_len [ string length $n1 ]
set input [ list \
"$CSI$n1;${n2}H" \
"$DCS$n1;$n2|$n3$ST" \
"$CSI<?${n1}Z" \
]
set output [ list \
"OK CUP $n1 $n2" \
"OK DECUDK $n1 $n2 $n3" \
"NOMATCH [ expr { $n1_len + 5 } ] ESC \[ < ? [ split $n1 {} ] Z" \
]
tcsgrep_start
for { set i 0 } { $i < [ llength $input ] } { incr i } {
set seq [ lindex $input $i ]
set expected [ lindex $output $i ]
send $seq
expect {
-ex "$expected\n" {
pass "pass"
}
default {
puts $expect_out(buffer)
fail "fail"
}
}
}
tcsgrep_stop