#BUGFIX by sr
authorsr
Wed, 11 Oct 2017 11:06:48 +0200
changeset 1785 3f585cff357f
parent 1784 247e123f1061
child 1786 665a0c69ecb2
#BUGFIX by sr class: RegressionTests::IntegerTest class definition comment/format in: #testLargeAddition1 #testLargeAddition2 #testLargeAddition3 #testSmallIntegerDivision1 #testSmallIntegerMultiplication1 #testSmallIntegerMultiplication1b #testSmallIntegerMultiplication2 #testSmallIntegerMultiplication3 #testSmallIntegerNegation #test_gcdBug1 #test_gcdBug2 #test_gcdBug3
RegressionTests__IntegerTest.st
--- a/RegressionTests__IntegerTest.st	Wed Oct 11 10:38:53 2017 +0200
+++ b/RegressionTests__IntegerTest.st	Wed Oct 11 11:06:48 2017 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "{ Package: 'stx:goodies/regression' }"
 
 "{ NameSpace: RegressionTests }"
@@ -2139,7 +2141,7 @@
      and via constructed performs. The reason is to test both inlined
      JIT-compiler code AND the regular methods code."
 
-    |s n1 n2 x|
+    |n1 n2|
 
     "Large + Small addition"
 
@@ -2184,7 +2186,7 @@
      and via constructed performs. The reason is to test both inlined
      JIT-compiler code AND the regular methods code."
 
-    |s n1 n2 x|
+    |n1 n2 x|
 
     "Large + Large addition"
 
@@ -2252,7 +2254,7 @@
      and via constructed performs. The reason is to test both inlined
      JIT-compiler code AND the regular methods code."
 
-    |s n1 n2 x|
+    |n1 n2|
 
     "Large - small subtraction"
     self assert:((20 factorial + 20 factorial - 1) printString = '4865804016353279999').
@@ -4648,7 +4650,7 @@
      and via constructed performs. The reason is to test both inlined
      JIT-compiler code AND the regular methods code."
 
-    |s n1 n2 t|
+    |n1 n2|
 
     n1 := 100000.
     n2 := n1 negated.
@@ -4849,7 +4851,7 @@
      and via constructed performs. The reason is to test both inlined
      JIT-compiler code AND the regular methods code."
 
-    |s n1 n2 t|
+    |n1 n2|
 
     n1 := 100000.
     n2 := n1 negated.
@@ -4902,7 +4904,7 @@
      and via constructed performs. The reason is to test both inlined
      JIT-compiler code AND the regular methods code."
 
-    |s n1 n2 t|
+    |n1 n2|
 
     n1 := 100000.
     n2 := n1 negated.
@@ -4958,7 +4960,7 @@
      and via constructed performs. The reason is to test both inlined
      JIT-compiler code AND the regular methods code."
 
-    |s n1 n2 t|
+    |n1 n2|
 
     n1 := 16rFFFF.
     n2 := n1 negated.
@@ -4985,9 +4987,9 @@
     self assert:((n2 perform:'*' asSymbol with:2) printString = '-2147483646').
 
     SmallInteger maxBytes == 4 ifTrue:[
-	n1 := 16r3FFFFFFF.
+        n1 := 16r3FFFFFFF.
     ] ifFalse:[
-	n1 := 16r3FFFFFFFFFFFFFFF.
+        n1 := 16r3FFFFFFFFFFFFFFF.
     ].
     self assert:(n1 class == SmallInteger).
     self assert:((n1 * 2) class == LargeInteger).
@@ -5268,35 +5270,37 @@
 !
 
 test_gcdBug1
-    |theBase theMersenne theRest theGcd theOldRest theOldGcd|
+    |theBase theMersenne theRest theGcd theOldRest theOldGcd theFactorOrder|
 
     theBase := 2.
     132 to:135 do:[:theOrder |
-	false " <<<< here i replaced some piece of code by false just to reproduce the error without having to ship all my code >>>>" ifFalse:[
-	    theRest := ((theBase raisedTo:theOrder) - 1) / (theBase - 1).
-	    30 "theOrder - 1" to:67 do:[:theFactorOrder |
-		"/Transcript show:theOrder; space.
-		"/Transcript showCR:theFactorOrder.
-		(theOrder \\ theFactorOrder) = 0 ifTrue:[
-		    " <<<< is a divisor of the order >>>>"
-		    self assert:theFactorOrder ~= 131 description:'131 ist kein Teiler von 132'.
-		    self assert:(theOrder / theFactorOrder) isFraction not.
-		    theMersenne := ((theBase raisedTo:theFactorOrder) - 1) / (theBase - 1).
-		    theGcd := theRest gcd:theMersenne.
-		    [ theGcd > 1 ] whileTrue:[
-			self assert:theFactorOrder < 129.
-			theOldRest := theRest asString.
-			theOldGcd := theGcd asString.
-			theRest := theRest / theGcd.
-			theGcd := theGcd gcd:theRest.
-			self assert:((theRest \\ theGcd) = 0).
-			self assert:(theRest / theGcd) isFraction not.
-		    ].
-		].
-	    ].
-	    self assert:theRest ~= 1
-		description:'there is no prime factor of order theOrder'
-	].
+        false " here i replaced some piece of code by false just to reproduce the error without having to ship all my code " ifFalse:[
+            theRest := ((theBase raisedTo:theOrder) - 1) / (theBase - 1).
+            30 "theOrder - 1" to:67 do:[:theFactorOrderArg |
+                theFactorOrder := theFactorOrderArg.
+
+                "/Transcript show:theOrder; space.
+                "/Transcript showCR:theFactorOrder.
+                (theOrder \\ theFactorOrder) = 0 ifTrue:[
+                    "  is a divisor of the order "
+                    self assert:theFactorOrder ~= 131 description:'131 ist kein Teiler von 132'.
+                    self assert:(theOrder / theFactorOrder) isFraction not.
+                    theMersenne := ((theBase raisedTo:theFactorOrder) - 1) / (theBase - 1).
+                    theGcd := theRest gcd:theMersenne.
+                    [ theGcd > 1 ] whileTrue:[
+                        self assert:theFactorOrder < 129.
+                        theOldRest := theRest asString.
+                        theOldGcd := theGcd asString.
+                        theRest := theRest / theGcd.
+                        theGcd := theGcd gcd:theRest.
+                        self assert:((theRest \\ theGcd) = 0).
+                        self assert:(theRest / theGcd) isFraction not.
+                    ].
+                ].
+            ].
+            self assert:theRest ~= 1
+                description:'there is no prime factor of order theOrder'
+        ].
     ].
 
     "
@@ -5306,37 +5310,38 @@
 !
 
 test_gcdBug2
-    |theBase theMersenne theRest theGcd theOldRest theOldGcd|
+    |theBase theMersenne theRest theGcd theOldRest theOldGcd theFactorOrder|
 
     theBase := 2.
     132 to:135 do:[:theOrder |
-	false " <<<< here i replaced some piece of code by false just to
-	 reproduce the error without having to ship all my code >>>>"
-		ifFalse:[
-		    theRest := ((theBase raisedTo:theOrder) - 1) / (theBase - 1).
-		    60 "theOrder - 1" to:67 do:[:theFactorOrder |
-			"/Transcript show:theOrder; space.
-			"/Transcript showCR:theFactorOrder.
-			(theOrder \\ theFactorOrder) = 0 ifTrue:[
-			    " <<<< is a divisor of the order >>>>"
-			    self assert:theFactorOrder ~= 131 description:'131 ist kein Teiler von 132'.
-			    self assert:(theOrder / theFactorOrder) isFraction not.
-			    theMersenne := ((theBase raisedTo:theFactorOrder) - 1) / (theBase - 1).
-			    theGcd := theRest gcd:theMersenne.
-			    [ theGcd > 1 ] whileTrue:[
-				self assert:theFactorOrder < 129.
-				theOldRest := theRest asString.
-				theOldGcd := theGcd asString.
-				theRest := theRest / theGcd.
-				theGcd := theGcd gcd:theRest.
-				self assert:((theRest \\ theGcd) = 0).
-				self assert:(theRest / theGcd) isFraction not.
-			    ].
-			].
-		    ].
-		    self assert:theRest ~= 1
-			description:'there is no prime factor of order theOrder'
-		].
+        false "here i replaced some piece of code by false just to
+         reproduce the error without having to ship all my code "
+                ifFalse:[
+                    theRest := ((theBase raisedTo:theOrder) - 1) / (theBase - 1).
+                    60 "theOrder - 1" to:67 do:[:theFactorOrderArg |
+                        theFactorOrder := theFactorOrderArg.
+                        "/Transcript show:theOrder; space.
+                        "/Transcript showCR:theFactorOrder.
+                        (theOrder \\ theFactorOrder) = 0 ifTrue:[
+                            " is a divisor of the order "
+                            self assert:theFactorOrder ~= 131 description:'131 ist kein Teiler von 132'.
+                            self assert:(theOrder / theFactorOrder) isFraction not.
+                            theMersenne := ((theBase raisedTo:theFactorOrder) - 1) / (theBase - 1).
+                            theGcd := theRest gcd:theMersenne.
+                            [ theGcd > 1 ] whileTrue:[
+                                self assert:theFactorOrder < 129.
+                                theOldRest := theRest asString.
+                                theOldGcd := theGcd asString.
+                                theRest := theRest / theGcd.
+                                theGcd := theGcd gcd:theRest.
+                                self assert:((theRest \\ theGcd) = 0).
+                                self assert:(theRest / theGcd) isFraction not.
+                            ].
+                        ].
+                    ].
+                    self assert:theRest ~= 1
+                        description:'there is no prime factor of order theOrder'
+                ].
     ].
 
     "
@@ -5346,37 +5351,38 @@
 !
 
 test_gcdBug3
-    |theBase theMersenne theRest theGcd theOldRest theOldGcd|
+    |theBase theMersenne theRest theGcd theOldRest theOldGcd theFactorOrder|
 
     theBase := 2.
     132 to:135 do:[:theOrder |
-	false " <<<< here i replaced some piece of code by false just to
-	 reproduce the error without having to ship all my code >>>>"
-		ifFalse:[
-		    theRest := ((theBase raisedTo:theOrder) - 1) / (theBase - 1).
-		    2 to:theOrder - 1 do:[:theFactorOrder |
-			"/Transcript show:theOrder; space.
-			"/Transcript showCR:theFactorOrder.
-			(theOrder \\ theFactorOrder) = 0 ifTrue:[
-			    " <<<< is a divisor of the order >>>>"
-			    self assert:theFactorOrder ~= 131 description:'131 ist kein Teiler von 132'.
-			    self assert:(theOrder / theFactorOrder) isFraction not.
-			    theMersenne := ((theBase raisedTo:theFactorOrder) - 1) / (theBase - 1).
-			    theGcd := theRest gcd:theMersenne.
-			    [ theGcd > 1 ] whileTrue:[
-				self assert:theFactorOrder < 129.
-				theOldRest := theRest asString.
-				theOldGcd := theGcd asString.
-				theRest := theRest / theGcd.
-				theGcd := theGcd gcd:theRest.
-				self assert:((theRest \\ theGcd) = 0).
-				self assert:(theRest / theGcd) isFraction not.
-			    ].
-			].
-		    ].
-		    self assert:theRest ~= 1
-			description:'there is no prime factor of order theOrder'
-		].
+        false " here i replaced some piece of code by false just to
+         reproduce the error without having to ship all my code"
+                ifFalse:[
+                    theRest := ((theBase raisedTo:theOrder) - 1) / (theBase - 1).
+                    2 to:theOrder - 1 do:[:theFactorOrderArg |
+                        theFactorOrder := theFactorOrderArg.              
+                        "/Transcript show:theOrder; space.
+                        "/Transcript showCR:theFactorOrder.
+                        (theOrder \\ theFactorOrder) = 0 ifTrue:[
+                            " is a divisor of the order"
+                            self assert:theFactorOrder ~= 131 description:'131 ist kein Teiler von 132'.
+                            self assert:(theOrder / theFactorOrder) isFraction not.
+                            theMersenne := ((theBase raisedTo:theFactorOrder) - 1) / (theBase - 1).
+                            theGcd := theRest gcd:theMersenne.
+                            [ theGcd > 1 ] whileTrue:[
+                                self assert:theFactorOrder < 129.
+                                theOldRest := theRest asString.
+                                theOldGcd := theGcd asString.
+                                theRest := theRest / theGcd.
+                                theGcd := theGcd gcd:theRest.
+                                self assert:((theRest \\ theGcd) = 0).
+                                self assert:(theRest / theGcd) isFraction not.
+                            ].
+                        ].
+                    ].
+                    self assert:theRest ~= 1
+                        description:'there is no prime factor of order theOrder'
+                ].
     ].
 
     "