[squeak-dev] The Trunk: KernelTests-ul.213.mcz
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Mon Jan 23 17:56:22 UTC 2012
2012/1/23 <commits at source.squeak.org>:
> Levente Uzonyi uploaded a new version of KernelTests to project The Trunk:
> http://source.squeak.org/trunk/KernelTests-ul.213.mcz
>
> ==================== Summary ====================
>
> Name: KernelTests-ul.213
> Author: ul
> Time: 23 January 2012, 3:22:22.122 am
> UUID: 15536b29-64a8-7343-8668-bce592e0c78b
> Ancestors: KernelTests-nice.212
>
> - Fixed and enhanced IntegerTest >> #testIsPowerOfTwo.
> - Removed IntegerTest >> #testIsPowerOfTwoM6873, because #testIsPowerOfTwo now includes the same checks.
>
> =============== Diff against KernelTests-nice.212 ===============
>
> Item was changed:
> ----- Method: IntegerTest>>testIsPowerOfTwo (in category 'tests - basic') -----
> testIsPowerOfTwo
>
> + | powersOfTwo nonPowersOfTwo |
> + powersOfTwo := (0 to: 100) collect: [ :each |
> + 2 raisedTo: each ].
> + nonPowersOfTwo := (powersOfTwo collect: [ :each | each negated ]),
> + #(0 3 -3 5 -5 6 -6 7 -7 9 -9 10 -10 100 -100 1000 -1000 12345678 -12345678 1234567890 -1234567890 12345678901234567890 -12345678901234567890).
> + powersOfTwo do: [ :each |
> + self assert: each isPowerOfTwo ].
> + nonPowersOfTwo do: [ :each |
> + self deny: each isPowerOfTwo ]!
> - self assert: (0 isPowerOfTwo).
> - self assert: (1 isPowerOfTwo).
> - self assert: (2 isPowerOfTwo).
> - self deny: (3 isPowerOfTwo).
> - self assert: (4 isPowerOfTwo).
> - !
>
> Item was removed:
> - ----- Method: IntegerTest>>testIsPowerOfTwoM6873 (in category 'tests - basic') -----
> - testIsPowerOfTwoM6873
> - "This is a non regression test for http://bugs.squeak.org/view.php?id=6873"
> -
> - self deny: ((1 to: 80) anySatisfy: [:n | (2 raisedTo: n) negated isPowerOfTwo])
> - description: 'A negative integer cannot be a power of two'.!
>
>
For the sake of accuracy, the bug did occur for the opposite of some
specific power of two (as reported in
http://bugs.squeak.org/view.php?id=6873 )
which are not included in the nonPowersOfTwo serie:
(31 to: 111 by: 8) allSatisfy: [:n | (2 raisedTo: n) negated isPowerOfTwo]
But since the bug 6873 was a side effect of another one (the "root
bug" 6874) which has been solved, and since the root bug has its own
coverage tests, it is a good thing to simply remove
testIsPowerOfTwoM6873, and so I agree with this change.
Nicolas
More information about the Squeak-dev
mailing list
|