[Pkg] The Trunk: KernelTests-eem.288.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Feb 13 21:06:49 UTC 2015


Eliot Miranda uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-eem.288.mcz

==================== Summary ====================

Name: KernelTests-eem.288
Author: eem
Time: 13 February 2015, 1:06:38.236 pm
UUID: 88e264d5-a798-40c5-b260-b5ad42222ef4
Ancestors: KernelTests-nice.287

Make the testCreationFromBytes tests 64-bit Spur savvy

=============== Diff against KernelTests-nice.287 ===============

Item was changed:
  ----- Method: IntegerTest>>testCreationFromBytes1 (in category 'tests - instance creation') -----
  testCreationFromBytes1
  	"self run: #testCreationFromBytes1"
  	"it is illegal for a LargeInteger to be less than SmallInteger maxVal." 
  	"here we test that Integer>>byte!!byte2:byte3:byte4: resconstructs SmallInteger maxVal as an instance of SmallInteger. "
    
+ 	| maxSmallInt hexString 
+ 	builtInteger bytes |
- 	| maxSmallInt hexString byte1 byte2 byte3 byte4 
- 	builtInteger |
  	maxSmallInt := SmallInteger maxVal.
  	hexString := maxSmallInt printStringHex.
+ 	hexString size odd ifTrue:
+ 		[hexString := '0', hexString].
+ 	self assert: hexString size / 2 =  maxSmallInt digitLength.
+ 	bytes := (1 to: hexString size by: 2) collect:
+ 				[:i| Number readFrom: (hexString copyFrom: i to: i + 1) base: 16].
+ 	builtInteger := bytes size > 4
+ 					ifTrue:
+ 						[Integer
+ 							byte1: (bytes at: 1) byte2: (bytes at: 2) byte3: (bytes at: 3) byte4: (bytes at: 4)
+ 							byte5: (bytes at: 5) byte6: (bytes at: 6) byte7: (bytes at: 7) byte8: (bytes at: 8)]
+ 					ifFalse:
+ 						[Integer
+ 							byte1: (bytes at: 1) byte2: (bytes at: 2) byte3: (bytes at: 3) byte4: (bytes at: 4)].
- 	self assert: hexString size = 8.
- 	byte4 := Number readFrom: (hexString copyFrom: 1 to: 2) base: 16.
- 	byte3 := Number readFrom: (hexString copyFrom: 3 to: 4) base: 16.
- 	byte2 := Number readFrom: (hexString copyFrom: 5 to: 6) base: 16.
- 	byte1 := Number readFrom: (hexString copyFrom: 7 to: 8) base: 16.
- 	builtInteger := Integer byte1: byte1 byte2: byte2 byte3: byte3 byte4: byte4.
  	self assert: builtInteger = maxSmallInt.
  	self assert: builtInteger class = SmallInteger
  !

Item was changed:
  ----- Method: IntegerTest>>testCreationFromBytes2 (in category 'tests - instance creation') -----
  testCreationFromBytes2
   	"self run: #testCreationFromBytes2"
  
  	"it is illegal for a LargeInteger to be less than SmallInteger maxVal." 
  	"here we test that Integer>>byte!!byte2:byte3:byte4: resconstructs (SmallInteger maxVal + 1) as an instance of LargePositiveInteger. "
+ 	| maxSmallInt hexString builtInteger bytes |
- 	| maxSmallInt hexString byte1 byte2 byte3 byte4 builtInteger |
  	maxSmallInt := SmallInteger maxVal.
  	hexString := (maxSmallInt + 1) printStringHex.
+ 	hexString size odd ifTrue:
+ 		[hexString := '0', hexString].
+ 	self assert: hexString size / 2 =  maxSmallInt digitLength.
+ 	bytes := (1 to: hexString size by: 2) collect:
+ 				[:i| Number readFrom: (hexString copyFrom: i to: i + 1) base: 16].
+ 	builtInteger := bytes size > 4
+ 					ifTrue:
+ 						[Integer
+ 							byte1: (bytes at: 1) byte2: (bytes at: 2) byte3: (bytes at: 3) byte4: (bytes at: 4)
+ 							byte5: (bytes at: 5) byte6: (bytes at: 6) byte7: (bytes at: 7) byte8: (bytes at: 8)]
+ 					ifFalse:
+ 						[Integer
+ 							byte1: (bytes at: 1) byte2: (bytes at: 2) byte3: (bytes at: 3) byte4: (bytes at: 4)].
- 	self assert: hexString size = 8.
- 	byte4 := Number readFrom: (hexString copyFrom: 1 to: 2) base: 16.
- 	byte3 := Number readFrom: (hexString copyFrom: 3 to: 4) base: 16.
- 	byte2 := Number readFrom: (hexString copyFrom: 5 to: 6) base: 16.
- 	byte1 := Number readFrom: (hexString copyFrom: 7 to: 8) base: 16.
- 	builtInteger := Integer byte1: byte1 byte2: byte2 byte3: byte3 byte4: byte4.
  	self assert: builtInteger = (maxSmallInt + 1).
  	self deny: builtInteger class = SmallInteger
  !

Item was changed:
  ----- Method: IntegerTest>>testCreationFromBytes3 (in category 'tests - instance creation') -----
  testCreationFromBytes3
  	"self run: #testCreationFromBytes3"
  
  	"it is illegal for a LargeInteger to be less than SmallInteger maxVal." 
  	"here we test that Integer>>byte!!byte2:byte3:byte4: resconstructs (SmallInteger maxVal - 1) as an instance of SmallInteger. "
+ 	| maxSmallInt hexString 
+     builtInteger bytes |
- 	| maxSmallInt hexString byte1 byte2 byte3 byte4 
-     builtInteger |
  	maxSmallInt := SmallInteger maxVal.
  	hexString := (maxSmallInt - 1) printStringHex.
+ 	hexString size odd ifTrue:
+ 		[hexString := '0', hexString].
+ 	self assert: hexString size / 2 =  maxSmallInt digitLength.
+ 	bytes := (1 to: hexString size by: 2) collect:
+ 				[:i| Number readFrom: (hexString copyFrom: i to: i + 1) base: 16].
+ 	builtInteger := bytes size > 4
+ 					ifTrue:
+ 						[Integer
+ 							byte1: (bytes at: 1) byte2: (bytes at: 2) byte3: (bytes at: 3) byte4: (bytes at: 4)
+ 							byte5: (bytes at: 5) byte6: (bytes at: 6) byte7: (bytes at: 7) byte8: (bytes at: 8)]
+ 					ifFalse:
+ 						[Integer
+ 							byte1: (bytes at: 1) byte2: (bytes at: 2) byte3: (bytes at: 3) byte4: (bytes at: 4)].
- 	self assert: hexString size = 8.
- 	byte4 := Number readFrom: (hexString copyFrom: 1 to: 2) base: 16.
- 	byte3 := Number readFrom: (hexString copyFrom: 3 to: 4) base: 16.
- 	byte2 := Number readFrom: (hexString copyFrom: 5 to: 6) base: 16.
- 	byte1 := Number readFrom: (hexString copyFrom: 7 to: 8) base: 16.
- 	builtInteger := Integer byte1: byte1 byte2: byte2 byte3: byte3 byte4: byte4.
  	self assert: builtInteger = (maxSmallInt - 1).
  	self assert: builtInteger class = SmallInteger
  !



More information about the Packages mailing list