[squeak-dev] The Trunk: KernelTests-nice.231.mcz

David T. Lewis lewis at mail.msen.com
Fri Aug 31 22:53:00 UTC 2012


This turns out to be an exceptionally well written test. Some of the expressions
in the test will crash a VM that is compiled in 64 bit mode. But the test fails
before reaching that point, so it correctly identifies the problem in the VM
without actually crashing the the VM. Excellent :)

Dave


On Fri, Aug 31, 2012 at 09:01:39PM +0000, commits at source.squeak.org wrote:
> Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
> http://source.squeak.org/trunk/KernelTests-nice.231.mcz
> 
> ==================== Summary ====================
> 
> Name: KernelTests-nice.231
> Author: nice
> Time: 31 August 2012, 11:01:26.531 pm
> UUID: fb87513c-6c77-42a4-bd01-2d2b12acf8b8
> Ancestors: KernelTests-cmm.230
> 
> Add a test for (1<<63) negated arithmetic bugs
> 
> =============== Diff against KernelTests-cmm.230 ===============
> 
> Item was added:
> + ----- Method: LargeNegativeIntegerTest>>testMinimumNegativeIntegerArithmetic (in category 'tests') -----
> + testMinimumNegativeIntegerArithmetic
> + 	"We are speaking of minimum integer in underlying hardware here.
> + 	In 2-complement, abs(INT_MIN) = (INT-MAX+1) and thus overflows hardware register.
> + 	Since some old VM forgot this edge case they may fail and it's better to be aware of it.
> + 	http://code.google.com/p/cog/issues/detail?id=92
> + 	http://bugs.squeak.org/view.php?id=7705
> + 	We only test the cases of 32 and 64 bit signed integers."
> + 
> + 	#(32 64) do: [:nBits |
> + 		| largePositiveInt largeNegativeInt |
> + 		largePositiveInt := (1 << (nBits - 1)).
> + 		largeNegativeInt := largePositiveInt negated.
> + 		self assert: (largeNegativeInt >> 3) equals: (largeNegativeInt bitInvert >> 3) bitInvert.
> + 		self assert: (largeNegativeInt + 1) equals: (largePositiveInt - 1) negated.
> + 		self assert: (largeNegativeInt - -1) equals: (largePositiveInt - 1) negated.
> + 		self assert: (largeNegativeInt // -1) equals: largePositiveInt.
> + 		self assert: (largeNegativeInt \\ -1) equals: 0.
> + 		self assert: (largeNegativeInt rem: -1) equals: 0.
> + 		self assert: (largeNegativeInt quo: -1) equals: largePositiveInt.
> + 		self assert: (largeNegativeInt * -1) equals: largePositiveInt.
> + 		self assert: (largeNegativeInt / -1) equals: largePositiveInt]!
> 


More information about the Squeak-dev mailing list