diff options
author | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2007-10-25 18:09:45 +0000 |
---|---|---|
committer | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2007-10-25 18:09:45 +0000 |
commit | 93004d61a64d53bc3e762e2f4249bc71f75e1cf3 (patch) | |
tree | 3a9ea38f2d7b60b1f28c79345fa364809323bb95 /gdb/testsuite/gdb.base/dfp-exprs.exp | |
parent | 27bc4d809ea2b4a3e4833806494db3a2fee83c64 (diff) | |
download | gdb-93004d61a64d53bc3e762e2f4249bc71f75e1cf3.zip gdb-93004d61a64d53bc3e762e2f4249bc71f75e1cf3.tar.gz gdb-93004d61a64d53bc3e762e2f4249bc71f75e1cf3.tar.bz2 |
2007-10-15 Wu Zhou <woodzltc@cn.ibm.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
* gdb.base/dfp-exprs.exp: new file adding tests for Decimal
Floating Point expressions.
* gdb.base/dfp-test.exp: new file adding tests for Decimal
Floating Point variables.
* gdb.base/dfp-test.c: new file containing program with Decimal
Floating variables, used by gdb.base/dfp-test.exp.
Diffstat (limited to 'gdb/testsuite/gdb.base/dfp-exprs.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/dfp-exprs.exp | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/dfp-exprs.exp b/gdb/testsuite/gdb.base/dfp-exprs.exp new file mode 100644 index 0000000..51adfde --- /dev/null +++ b/gdb/testsuite/gdb.base/dfp-exprs.exp @@ -0,0 +1,94 @@ +# Copyright (C) 2007 Free Software Foundation, Inc. + +# 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 <http://www.gnu.org/licenses/>. + +# This file was written by Wu Zhou. (woodzltc@cn.ibm.com) + +# This file is part of the gdb testsuite. It contains test for evaluating +# simple decimal floating point (DFP) expression. + +if $tracelevel then { + strace $tracelevel +} + +proc test_dfp_literals_accepted {} { + + # Test various dfp values, covering 32-bit, 64-bit and 128-bit ones + + # _Decimal32 constants, which can support up to 7 digits + gdb_test "p 1.2df" " = 1.2" + gdb_test "p -1.2df" " = -1.2" + gdb_test "p 1.234567df" " = 1.234567" + gdb_test "p -1.234567df" " = -1.234567" + gdb_test "p 1234567.df" " = 1234567" + gdb_test "p -1234567.df" " = -1234567" + + gdb_test "p 1.2E1df" " = 12" + gdb_test "p 1.2E10df" " = 1.2E\\+10" + gdb_test "p 1.2E-10df" " = 1.2E-10" + + # The largest exponent for 32-bit dfp value is 96. + gdb_test "p 1.2E96df" " = 1.200000E\\+96" + + # _Decimal64 constants, which can support up to 16 digits + gdb_test "p 1.2dd" " = 1.2" + gdb_test "p -1.2dd" " = -1.2" + gdb_test "p 1.234567890123456dd" " = 1.234567890123456" + gdb_test "p -1.234567890123456dd" " = -1.234567890123456" + gdb_test "p 1234567890123456.dd" " = 1234567890123456" + gdb_test "p -1234567890123456.dd" " = -1234567890123456" + + gdb_test "p 1.2E1dd" " = 12" + gdb_test "p 1.2E10dd" " = 1.2E\\+10" + gdb_test "p 1.2E-10dd" " = 1.2E-10" + + # The largest exponent for 64-bit dfp value is 384. + gdb_test "p 1.2E384dd" " = 1.200000000000000E\\+384" + + # _Decimal128 constants, which can support up to 34 digits + gdb_test "p 1.2dl" " = 1.2" + gdb_test "p -1.2dl" " = -1.2" + gdb_test "p 1.234567890123456789012345678901234dl" " = 1.234567890123456789012345678901234" + gdb_test "p -1.234567890123456789012345678901234dl" " = -1.234567890123456789012345678901234" + gdb_test "p 1234567890123456789012345678901234.dl" " = 1234567890123456789012345678901234" + gdb_test "p -1234567890123456789012345678901234.dl" " = -1234567890123456789012345678901234" + + gdb_test "p 1.2E1dl" " = 12" + gdb_test "p 1.2E10dl" " = 1.2E\\+10" + gdb_test "p 1.2E-10dl" " = 1.2E-10" + + # The largest exponent for 128-bit dfp value is 6144. + gdb_test "p 1.2E6144dl" " = 1.200000000000000000000000000000000E\\+6144" +} + +proc test_dfp_arithmetic_expressions {} { + +# Arithmetic operations for DFP types are not yet implemented in GDB. +# These tests are to verify that they will generate expected error messages. + + gdb_test "p 1.4df + 1.2df" "Argument to arithmetic operation not a number or boolean.*" + gdb_test "p 1.4df - 1.2df" ".*Argument to arithmetic operation not a number or boolean.*" + gdb_test "p 1.4df * 1.2df" "Argument to arithmetic operation not a number or boolean.*" + gdb_test "p 1.4df / 1.2df" "Argument to arithmetic operation not a number or boolean.*" + +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +test_dfp_literals_accepted +test_dfp_arithmetic_expressions |