1 # Copyright (C) 1995, 1997 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
20 # This file tests various Chill values, expressions, and types.
26 if [skip_chill_tests] then { continue }
28 set testfile "powerset"
29 set srcfile ${srcdir}/$subdir/${testfile}.ch
30 set binfile ${objdir}/${subdir}/${testfile}.exe
31 if { [compile "${srcfile} -g -w -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } {
32 perror "Couldn't compile ${srcfile}"
36 # Set the current language to chill. This counts as a test. If it
37 # fails, then we skip the other tests.
39 proc set_lang_chill {} {
41 global binfile objdir subdir
43 verbose "loading file '$binfile'"
45 send_gdb "set language chill\n"
47 -re ".*$gdb_prompt $" {}
48 timeout { fail "set language chill (timeout)" ; return 0 }
51 send_gdb "show language\n"
53 -re ".* source language is \"chill\".*$gdb_prompt $" {
54 pass "set language to \"chill\""
55 send_gdb "break xx_\n"
57 -re ".*$gdb_prompt $" {
59 gdb_expect -re ".*$gdb_prompt $" {}
63 fail "can't set breakpoint (timeout)"
68 -re ".*$gdb_prompt $" {
69 fail "setting language to \"chill\""
73 fail "can't show language (timeout)"
79 # Testing printing of a specific value. Increment passcount for
80 # success or issue fail message for failure. In both cases, return
81 # a 1 to indicate that more tests can proceed. However a timeout
82 # is a serious error, generates a special fail message, and causes
83 # a 0 to be returned to indicate that more tests are likely to fail
88 # First one is string to send_gdb to gdb
89 # Second one is string to match gdb result to
90 # Third one is an optional message to be printed
92 proc test_print_accept { args } {
97 if [llength $args]==3 then {
98 set message [lindex $args 2]
100 set message [lindex $args 0]
102 set sendthis [lindex $args 0]
103 set expectthis [lindex $args 1]
104 set result [gdb_test $sendthis ".* = ${expectthis}" $message]
105 if $result==0 {incr passcount}
112 verbose "testing builtin CARD"
115 # discrete mode names
116 test_print_accept "print card(v_ps1)" "4"
117 test_print_accept "print card(v_ps2)" "15"
118 test_print_accept "print card(v_ps3)" "4"
119 test_print_accept "print card(v_ps4)" "11"
120 test_print_accept "print card(v_ps5)" "1"
121 test_print_accept "print card(v_ps51)" "0"
122 test_print_accept "print card(v_ps6)" "101"
126 test_print_accept "print card(m_ps1)" "typename in invalid context"
132 verbose "testing builtin MIN"
135 # discrete mode names
136 test_print_accept "print min(v_ps1)" "1"
137 test_print_accept "print min(v_ps2)" "-100"
138 test_print_accept "print min(v_ps3)" "bb"
139 test_print_accept "print min(v_ps4)" "','"
140 test_print_accept "print min(v_ps5)" "FALSE"
141 test_print_accept "print min(v_ps6)" "-50"
145 test_print_accept "print min(v_ps51)" "MIN for empty powerset"
147 test_print_accept "print min(m_ps1)" "typename in invalid context"
153 verbose "testing builtin MIN"
156 # discrete mode names
157 test_print_accept "print max(v_ps1)" "7"
158 test_print_accept "print max(v_ps2)" "100"
159 test_print_accept "print max(v_ps3)" "ii"
160 test_print_accept "print max(v_ps4)" "'z'"
161 test_print_accept "print max(v_ps5)" "FALSE"
162 test_print_accept "print max(v_ps6)" "50"
165 test_print_accept "print 0 in v_ps6" "TRUE"
169 test_print_accept "print max(v_ps51)" "MAX for empty powerset"
172 # Start with a fresh gdb.
176 gdb_reinitialize_dir $srcdir/$subdir
178 gdb_test "set print sevenbit-strings ".*"
180 if [set_lang_chill] then {
181 # test builtins as described in chapter 6.20.3 Z.200
186 warning "$test_name tests suppressed."