#REFACTORING by stefan
class: RegressionTests::SmallIntegerTest
comment/format in:
#testBitShiftNegative
#testMinVal
16r-xxx instead of -16rxxx
--- a/RegressionTests__SmallIntegerTest.st Tue Sep 19 16:37:09 2017 +0200
+++ b/RegressionTests__SmallIntegerTest.st Tue Sep 19 16:38:16 2017 +0200
@@ -83,65 +83,67 @@
testBitShiftNegative
#(
- (-1 1 -2)
- (-1 2 -4)
- (-1 3 -8)
- (-1 7 -16r080)
- (-1 8 -16r100)
- (-1 15 -16r08000)
- (-1 16 -16r10000)
- (-1 17 -16r20000)
- (-1 30 -16r040000000)
- (-1 31 -16r080000000)
- (-1 32 -16r100000000)
- (-1 33 -16r200000000)
+ (-1 1 -2)
+ (-1 2 -4)
+ (-1 3 -8)
+ (-1 7 16r-080)
+ (-1 8 16r-100)
+ (-1 15 16r-08000)
+ (-1 16 16r-10000)
+ (-1 17 16r-20000)
+ (-1 30 16r-040000000)
+ (-1 31 16r-080000000)
+ (-1 32 16r-100000000)
+ (-1 33 16r-200000000)
- (-1 62 -16r04000000000000000)
- (-1 63 -16r08000000000000000)
- (-1 64 -16r10000000000000000)
- (-1 65 -16r20000000000000000)
+ (-1 62 16r-04000000000000000)
+ (-1 63 16r-08000000000000000)
+ (-1 64 16r-10000000000000000)
+ (-1 65 16r-20000000000000000)
- (-1 126 -16r040000000000000000000000000000000)
- (-1 127 -16r080000000000000000000000000000000)
- (-1 128 -16r100000000000000000000000000000000)
- (-1 129 -16r200000000000000000000000000000000)
+ (-1 126 16r-040000000000000000000000000000000)
+ (-1 127 16r-080000000000000000000000000000000)
+ (-1 128 16r-100000000000000000000000000000000)
+ (-1 129 16r-200000000000000000000000000000000)
- (-16r10 1 -16r20)
- (-16r10 2 -16r40)
- (-16r10 3 -16r80)
- (-16r10 7 -16r0800)
- (-16r10 8 -16r1000)
- (-16r10 15 -16r080000)
- (-16r10 16 -16r100000)
- (-16r10 17 -16r200000)
- (-16r10 30 -16r0400000000)
- (-16r10 31 -16r0800000000)
- (-16r10 32 -16r1000000000)
- (-16r10 33 -16r2000000000)
+ (16r-10 1 16r-20)
+ (16r-10 2 16r-40)
+ (16r-10 3 16r-80)
+ (16r-10 7 16r-0800)
+ (16r-10 8 16r-1000)
+ (16r-10 15 16r-080000)
+ (16r-10 16 16r-100000)
+ (16r-10 17 16r-200000)
+ (16r-10 30 16r-0400000000)
+ (16r-10 31 16r-0800000000)
+ (16r-10 32 16r-1000000000)
+ (16r-10 33 16r-2000000000)
- (-16r10 62 -16r040000000000000000)
- (-16r10 63 -16r080000000000000000)
- (-16r10 64 -16r100000000000000000)
- (-16r10 65 -16r200000000000000000)
+ (16r-10 62 16r-040000000000000000)
+ (16r-10 63 16r-080000000000000000)
+ (16r-10 64 16r-100000000000000000)
+ (16r-10 65 16r-200000000000000000)
- (-16r10 126 -16r0400000000000000000000000000000000)
- (-16r10 127 -16r0800000000000000000000000000000000)
- (-16r10 128 -16r1000000000000000000000000000000000)
- (-16r10 129 -16r2000000000000000000000000000000000)
+ (16r-10 126 16r-0400000000000000000000000000000000)
+ (16r-10 127 16r-0800000000000000000000000000000000)
+ (16r-10 128 16r-1000000000000000000000000000000000)
+ (16r-10 129 16r-2000000000000000000000000000000000)
) triplesDo:[:val :cnt :expected |
- |rslt1 rslt2|
+ |rslt1 rslt2|
- rslt1 := val bitShift:cnt.
- self assert:(rslt1 = expected).
- expected class == SmallInteger ifTrue:[
- self assert:(rslt1 == expected)
- ].
- rslt2 := rslt1 bitShift:cnt negated.
- self assert:(rslt2 = val).
- val class == SmallInteger ifTrue:[
- self assert:(rslt2 == val)
- ].
+ rslt1 := val bitShift:cnt.
+ self assert:(rslt1 = expected).
+ expected class == SmallInteger ifTrue:[
+ self assert:(rslt1 == expected)
+ ].
+ rslt2 := rslt1 bitShift:cnt negated.
+ self assert:(rslt2 = val).
+ val class == SmallInteger ifTrue:[
+ self assert:(rslt2 == val)
+ ].
].
+
+ "Modified (format): / 19-09-2017 / 16:29:36 / stefan"
!
testDivide
@@ -309,16 +311,18 @@
"/ the original code did not check for pointer-size;
Smalltalk isSmalltalkX ifTrue:[
- SmallInteger maxBytes == 4 ifTrue:[
- self should: [SmallInteger minVal = -16r40000000].
- self should: [SmallInteger minVal == -16r40000000].
- ] ifFalse:[
- self should: [SmallInteger minVal = -16r4000000000000000].
- self should: [SmallInteger minVal == -16r4000000000000000].
- ].
+ SmallInteger maxBytes == 4 ifTrue:[
+ self should: [SmallInteger minVal = 16r-40000000].
+ self should: [SmallInteger minVal == 16r-40000000].
+ ] ifFalse:[
+ self should: [SmallInteger minVal = 16r-4000000000000000].
+ self should: [SmallInteger minVal == 16r-4000000000000000].
+ ].
] ifFalse:[
- self should: [SmallInteger minVal = -16r40000000].
+ self should: [SmallInteger minVal = 16r-40000000].
]
+
+ "Modified (format): / 19-09-2017 / 16:29:45 / stefan"
!
testNew