summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-10-29 12:11:18 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-10-29 12:11:18 (GMT)
commit6f3900163a50d04ecae173e2703f626f5daf8318 (patch)
tree44f8666f2bb15ad7cbeb2f41e740bc5a67c080bf /Lib/test
parent0c67312c5c0d5d44e065d2ecc5023d0e47f815ee (diff)
downloadcpython-6f3900163a50d04ecae173e2703f626f5daf8318.zip
cpython-6f3900163a50d04ecae173e2703f626f5daf8318.tar.gz
cpython-6f3900163a50d04ecae173e2703f626f5daf8318.tar.bz2
Issue #7233: Fix Decimal.shift and Decimal.rotate methods for
arguments with more digits than the current context precision. Bug reported by Stefan Krah.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/decimaltestdata/extra.decTest29
1 files changed, 29 insertions, 0 deletions
diff --git a/Lib/test/decimaltestdata/extra.decTest b/Lib/test/decimaltestdata/extra.decTest
index f80d5f3..2640842 100644
--- a/Lib/test/decimaltestdata/extra.decTest
+++ b/Lib/test/decimaltestdata/extra.decTest
@@ -186,6 +186,35 @@ extr1507 comparetotal -sNaN45 -sNaN123 -> 1
extr1510 comparetotal -sNaN63450748854172416 -sNaN911993 -> -1
extr1511 comparetotmag NaN1222222222222 -NaN999999 -> 1
+-- Issue #7233: rotate and scale should truncate an argument
+-- of length greater than the current precision.
+precision: 4
+extr1600 rotate 1234567 -5 -> NaN Invalid_operation
+extr1601 rotate 1234567 -4 -> 4567
+extr1602 rotate 1234567 -3 -> 5674
+extr1603 rotate 1234567 -2 -> 6745
+extr1604 rotate 1234567 -1 -> 7456
+extr1605 rotate 1234567 0 -> 4567
+extr1606 rotate 1234567 1 -> 5674
+extr1607 rotate 1234567 2 -> 6745
+extr1608 rotate 1234567 3 -> 7456
+extr1609 rotate 1234567 4 -> 4567
+extr1610 rotate 1234567 5 -> NaN Invalid_operation
+
+extr1650 shift 1234567 -5 -> NaN Invalid_operation
+extr1651 shift 1234567 -4 -> 0
+extr1652 shift 1234567 -3 -> 4
+extr1653 shift 1234567 -2 -> 45
+extr1654 shift 1234567 -1 -> 456
+extr1655 shift 1234567 0 -> 4567
+extr1656 shift 1234567 1 -> 5670
+extr1657 shift 1234567 2 -> 6700
+extr1658 shift 1234567 3 -> 7000
+extr1659 shift 1234567 4 -> 0
+extr1660 shift 1234567 5 -> NaN Invalid_operation
+
+
+
-- Tests for the is_* boolean operations
precision: 9
maxExponent: 999