RegressionTests__IntegerTest.st
branchjv
changeset 1485 5a1aadddbc7f
parent 1483 8e5a0f125106
child 1487 c737fa75ba5a
equal deleted inserted replaced
1484:e5af485c693d 1485:5a1aadddbc7f
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "{ Package: 'exept:regression' }"
     1 "{ Package: 'exept:regression' }"
     4 
     2 
     5 "{ NameSpace: RegressionTests }"
     3 "{ NameSpace: RegressionTests }"
     6 
     4 
     7 TestCase subclass:#IntegerTest
     5 TestCase subclass:#IntegerTest
  1253         16r000000FFFFFFFFFFFF
  1251         16r000000FFFFFFFFFFFF
  1254         16r0000FFFFFFFFFFFFFF
  1252         16r0000FFFFFFFFFFFFFF
  1255         16r00FFFFFFFFFFFFFFFF
  1253         16r00FFFFFFFFFFFFFFFF
  1256         16rFFFFFFFFFFFFFFFFFF
  1254         16rFFFFFFFFFFFFFFFFFF
  1257     ) do:[:m |
  1255     ) do:[:m |
  1258         Transcript showCR:m.
  1256         "/ Transcript showCR:m.
  1259         nr := 1.
  1257         nr := 1.
  1260         1 to:100 do:[:n |
  1258         1 to:100 do:[:n |
  1261             nr := nr * m
  1259             nr := nr * m
  1262         ].
  1260         ].
  1263         1 to:100 do:[:n |
  1261         1 to:100 do:[:n |
  1264             nr := nr / m
  1262             nr := nr / m
  1265         ].
  1263         ].
  1266         self assert:(nr == 1).
  1264         self assert:(nr == 1) description:('failed in division of ',m printString).
  1267     ].
  1265     ].
  1268 
  1266 
  1269     "
  1267     "
  1270      self new testDivision3
  1268      self new testDivision3
  1271      Time millisecondsToRun:[ self new testDivision3 ] 14440
  1269      Time millisecondsToRun:[ self new testDivision3 ] 14440
  4011 
  4009 
  4012 testReadingPrinting1
  4010 testReadingPrinting1
  4013     |nr inString outString|
  4011     |nr inString outString|
  4014 
  4012 
  4015     #(2 3 4 5 8 10 16) do:[:radix |
  4013     #(2 3 4 5 8 10 16) do:[:radix |
  4016         Transcript showCR:('testing radix %1...' bindWith:radix).
  4014         "/ Transcript showCR:('testing radix %1...' bindWith:radix).
  4017         1 to:1000 do:[:len |
  4015         1 to:1000 do:[:len |
  4018             inString := '1',(String new:len withAll:$0).
  4016             inString := '1',(String new:len withAll:$0).
  4019             nr := Integer readFrom:inString radix:radix.
  4017             nr := Integer readFrom:inString radix:radix.
  4020             outString := nr printStringRadix:radix.
  4018             outString := nr printStringRadix:radix.
  4021             self assert:(outString = inString).
  4019             self assert:(outString = inString) description:('read/print failed for radix ',radix printString).
  4022         ].    
  4020         ].    
  4023     ].
  4021     ].
  4024     
  4022     
  4025     "
  4023     "
  4026      self basicNew testReadingPrinting1
  4024      self basicNew testReadingPrinting1