gdb: Allow GDB to _not_ load a previous command history
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / complex-parts.exp
1 # Copyright 2019-2020 Free Software Foundation, Inc.
2
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 3 of the License, or
6 # (at your option) any later version.
7 #
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.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 standard_testfile
17
18 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
19 return -1
20 }
21
22 if { ![runto_main] } then {
23 fail "can't run to main"
24 return 0
25 }
26
27 gdb_breakpoint [gdb_get_line_number "Break Here"]
28 gdb_continue_to_breakpoint "breakpt" ".* Break Here\\. .*"
29
30 gdb_test "p z1" " = 1.5 \\+ 4.5 \\* I"
31 gdb_test "p z2" " = 2.5 \\+ -5.5 \\* I"
32 gdb_test "p z3" " = 3.5 \\+ 6.5 \\* I"
33
34 gdb_test "ptype z1" " = complex double"
35 gdb_test "ptype z2" " = complex float"
36 gdb_test "ptype z3" " = complex long double"
37
38 gdb_test "p \$_cimag (z1)" " = 4.5"
39 gdb_test "ptype \$" " = double"
40
41 gdb_test "p \$_cimag (z2)" " = -5.5"
42 gdb_test "ptype \$" " = float"
43
44 gdb_test "p \$_cimag (z3)" " = 6.5"
45 gdb_test "ptype \$" " = long double"
46
47 gdb_test "p \$_creal (z1)" " = 1.5"
48 gdb_test "ptype \$" " = double"
49
50 gdb_test "p \$_creal (z2)" " = 2.5"
51 gdb_test "ptype \$" " = float"
52
53 gdb_test "p \$_creal (z3)" " = 3.5"
54 gdb_test "ptype \$" " = long double"
55
56 gdb_test "p \$_cimag (d1)" "expected a complex number"
57 gdb_test "p \$_cimag (f1)" "expected a complex number"
58 gdb_test "p \$_cimag (i1)" "expected a complex number"
59
60 gdb_test "p \$_creal (d1)" "expected a complex number"
61 gdb_test "p \$_creal (f1)" "expected a complex number"
62 gdb_test "p \$_creal (i1)" "expected a complex number"
This page took 0.037416 seconds and 4 git commands to generate.