# expect/tcl code to test the das scanner
# jhrg
#
# $Log: scanner.c.exp,v $
# Revision 1.2 2002/06/03 22:21:16 jimg
# Merged with release-3-2-9
#
# Revision 1.1.54.1 2001/11/01 00:43:52 jimg
# Fixes to the scanners and parsers so that dataset variable names may
# start with digits. I've expanded the set of characters that may appear
# in a variable name and made it so that all except `#' may appear at
# the start. Some characters are not allowed in variables that appear in
# a DDS or CE while they are allowed in the DAS. This makes it possible
# to define containers with names like `COARDS:long_name.' Putting a colon
# in a variable name makes the CE parser much more complex. Since the set
# of characters that people want seems pretty limited (compared to the
# complete ASCII set) I think this is an OK approach. If we have to open
# up the expr.lex scanner completely, then we can but not without adding
# lots of action clauses to teh parser. Note that colon is just an example,
# there's a host of characters that are used in CEs that are not allowed
# in IDs.
#
# Revision 1.1 1996/07/16 16:54:43 jimg
# Added.
#
#
# Some of the float values are not legal but the parser will (should) report
# those errors.
global comp_output # contains output from das-test_start
global verbose # this and srcdir are set by runtest.exp
global srcdir
set test_name scanner.c
set prompt "das-test:"
set timeout 2
set pass 1
das-test_start s
expect {
"${prompt} " {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
if {$pass} {
set thing "0.0\r\n"
send $thing
expect {
-re ".*WORD=${thing}${prompt} $" {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
}
if {$pass} {
set thing ".1\r\n"
send $thing
expect {
-re ".*WORD=${thing}${prompt} $" {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
}
if {$pass} {
set thing "+1.0\r\n"
set thing2 "\\+1.0\r\n"
send $thing
expect {
-re ".*WORD=${thing2}${prompt} $" {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
}
if {$pass} {
set thing "+1.0e9\r\n"
set thing2 "\\+1.0e9\r\n"
send $thing
expect {
-re ".*WORD=${thing2}${prompt} $" {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
}
if {$pass} {
set thing "+1.0e+9\r\n"
set thing2 "\\+1.0e\\+9\r\n"
send $thing
expect {
-re ".*WORD=${thing2}${prompt} $" {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
}
if {$pass} {
set thing "-1.0e+9\r\n"
set thing2 "-1.0e\\+9\r\n"
send -- $thing
expect {
-re ".*WORD=${thing2}${prompt} $" {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
}
if {$pass} {
set thing "-1.0e+99\r\n"
set thing2 "-1.0e\\+99\r\n"
send -- $thing
expect {
-re ".*WORD=${thing2}${prompt} $" {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
}
if {$pass} {
set thing "-256.256e-99\r\n"
send -- $thing
expect {
-re ".*WORD=${thing}${prompt} $" {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
}
if {$pass} {
set thing "+255.999e-9999999\r\n"
set thing2 "\\+255.999e-9999999\r\n"
send -- $thing
expect {
-re ".*WORD=${thing2}${prompt} $" {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
}
if {$pass} {
set thing "-255.999e+9999999\r\n"
set thing2 "-255.999e\\+9999999\r\n"
send -- $thing
expect {
-re ".*WORD=${thing2}${prompt} $" {
}
timeout {
send_user "Timeout\n"
set pass 0
}
}
}
if {$pass} {
pass $test_name
} else {
fail $test_name
}
das-test_exit