diff options
author | Pedro Alves <pedro@palves.net> | 2021-12-10 22:41:54 +0000 |
---|---|---|
committer | Lancelot SIX <lsix@lancelotsix.com> | 2022-01-07 22:43:33 +0000 |
commit | ffd5d21ae272aba3efdee3d677050b69c09e6f16 (patch) | |
tree | 23662f05c1e1588320f4bb8c64aee4dfd0e1992e | |
parent | 0988568e6af1e3bcfff37934c4482b5465947635 (diff) | |
download | binutils-ffd5d21ae272aba3efdee3d677050b69c09e6f16.zip binutils-ffd5d21ae272aba3efdee3d677050b69c09e6f16.tar.gz binutils-ffd5d21ae272aba3efdee3d677050b69c09e6f16.tar.bz2 |
gdb/testsuite: Remove duplicates from gdb.base/dfp-exprs.exp
When I run the testsuite, I have:
Running ../gdb/testsuite/gdb.base/dfp-exprs.exp ...
DUPLICATE: gdb.base/dfp-exprs.exp: p 1.2dl < 1.3df
Replace hand-written tests checking various comparison operators between
various decimal floating point types with a loop to programmatically
generate all the combinations. This removes the need to eyeball for all
suffixes, which lead to the original duplication.
Also add a lot more combinations, testing all comparison operators
comprehensively. The result is 262 unique tests vs 104 before this
patch.
Tested on x86_86-linux.
Change-Id: Id215a3d610aa8e032bf06ee160b5e3aed4a92d1e
-rw-r--r-- | gdb/testsuite/gdb.base/dfp-exprs.exp | 94 |
1 files changed, 57 insertions, 37 deletions
diff --git a/gdb/testsuite/gdb.base/dfp-exprs.exp b/gdb/testsuite/gdb.base/dfp-exprs.exp index 424725f..2684f70 100644 --- a/gdb/testsuite/gdb.base/dfp-exprs.exp +++ b/gdb/testsuite/gdb.base/dfp-exprs.exp @@ -122,43 +122,63 @@ proc test_dfp_arithmetic_expressions {} { gdb_test "p 1.2df + 1.2f" "Mixing decimal floating types with other floating types is not allowed." # Test other operations with DFP operands - gdb_test "p !0.df" " = 1" - gdb_test "p !0.dd" " = 1" - gdb_test "p !0.dl" " = 1" - gdb_test "p !0.5df" " = 0" - gdb_test "p !0.5dd" " = 0" - gdb_test "p !0.5dl" " = 0" - - gdb_test "p 1.2df == 1.2df" " = 1" - gdb_test "p 1.2df == 1.2dd" " = 1" - gdb_test "p 1.2df == 1.2dl" " = 1" - gdb_test "p 1.2dd == 1.2df" " = 1" - gdb_test "p 1.2dd == 1.2dl" " = 1" - gdb_test "p 1.2dl == 1.2df" " = 1" - gdb_test "p 1.2dl == 1.2dd" " = 1" - gdb_test "p 1.2df == 1.3df" " = 0" - gdb_test "p 1.2df == 1.3dd" " = 0" - gdb_test "p 1.2df == 1.3dl" " = 0" - gdb_test "p 1.2dd == 1.3df" " = 0" - gdb_test "p 1.2dd == 1.3dl" " = 0" - gdb_test "p 1.2dl == 1.3df" " = 0" - gdb_test "p 1.2dl == 1.3dd" " = 0" - - gdb_test "p +1.2df" " = 1.2" - gdb_test "p +1.2dd" " = 1.2" - gdb_test "p +1.2dl" " = 1.2" - - gdb_test "p 1.2df < 1.3df" " = 1" - gdb_test "p 1.2df < 1.3dd" " = 1" - gdb_test "p 1.2dl < 1.3df" " = 1" - gdb_test "p 1.2dd < 1.3dd" " = 1" - gdb_test "p 1.2dd < 1.3dl" " = 1" - gdb_test "p 1.2dl < 1.3dl" " = 1" - gdb_test "p 1.2dl < 1.3df" " = 1" - gdb_test "p 1.2df > 1" " = 1" - gdb_test "p 1.2dl > 2" " = 0" - gdb_test "p 2 > 1.2dd" " = 1" - gdb_test "p 2 > 3.1dl" " = 0" + + set dsuffix {"dd" "df" "dl"} + + foreach l $dsuffix { + foreach r $dsuffix { + gdb_test "p 1.2${l} == 1.2${r}" " = 1" + gdb_test "p 1.2${l} == 1.3${r}" " = 0" + + gdb_test "p 1.2${l} < 1.2${r}" " = 0" + gdb_test "p 1.2${l} < 1.3${r}" " = 1" + gdb_test "p 1.3${l} < 1.2${r}" " = 0" + + gdb_test "p 1.2${l} > 1.2${r}" " = 0" + gdb_test "p 1.2${l} > 1.3${r}" " = 0" + gdb_test "p 1.3${l} > 1.2${r}" " = 1" + + gdb_test "p 1.2${l} <= 1.2${r}" " = 1" + gdb_test "p 1.2${l} <= 1.3${r}" " = 1" + gdb_test "p 1.3${l} <= 1.2${r}" " = 0" + + gdb_test "p 1.2${l} >= 1.2${r}" " = 1" + gdb_test "p 1.2${l} >= 1.3${r}" " = 0" + gdb_test "p 1.3${l} >= 1.2${r}" " = 1" + } + + gdb_test "p !0.${l}" " = 1" + gdb_test "p !0.5${l}" " = 0" + + gdb_test "p +1.2${l}" " = 1.2" + + # This checks GDB doesn't convert to int and rounds up/down. + gdb_test "p 1.2${l} == 1" " = 0" + gdb_test "p 1.2${l} == 2" " = 0" + + gdb_test "p 1.2${l} == 1.2" \ + "Mixing decimal floating types with other floating types is not allowed\\." + + gdb_test "p 1.2${l} > 1" " = 1" + gdb_test "p 1.2${l} > 2" " = 0" + gdb_test "p 1.2${l} >= 1" " = 1" + gdb_test "p 1.2${l} >= 2" " = 0" + + gdb_test "p 1.2${l} < 1" " = 0" + gdb_test "p 1.2${l} < 2" " = 1" + gdb_test "p 1.2${l} <= 1" " = 0" + gdb_test "p 1.2${l} <= 2" " = 1" + + gdb_test "p 1 < 1.2${l}" " = 1" + gdb_test "p 2 < 1.2${l}" " = 0" + gdb_test "p 1 <= 1.2${l}" " = 1" + gdb_test "p 2 <= 1.2${l}" " = 0" + + gdb_test "p 1 > 1.2${l}" " = 0" + gdb_test "p 2 > 1.2${l}" " = 1" + gdb_test "p 1 >= 1.2${l}" " = 0" + gdb_test "p 2 >= 1.2${l}" " = 1" + } } proc test_dfp_conversions {} { |