Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.126.mcz ==================== Summary ==================== Name: KernelTests-nice.126 Author: nice Time: 27 December 2009, 8:50:28 am UUID: 83798bee-e21e-4aaf-ae60-1bcf2c7a4f9a Ancestors: KernelTests-nice.125 Cosmetic: move or remove a few temps inside closures =============== Diff against KernelTests-nice.125 =============== Item was changed: ----- Method: IntegerTest>>testBitAt (in category 'tests - bitLogic') ----- testBitAt + | trials bitSequence2 | - | trials aNumber bitSequence2 bitInvert | self assert: ((1 to: 100) allSatisfy: [:i | (0 bitAt: i) = 0]) description: 'all bits of zero are set to zero'. self assert: ((1 to: 100) allSatisfy: [:i | (-1 bitAt: i) = 1]) description: 'In two complements, all bits of -1 are set to 1'. trials := #( '2r10010011' '2r11100100' '2r10000000' '2r0000101011011001' '2r1000101011011001' '2r0101010101011000' '2r0010011110110010' '2r0010011000000000' '2r00100111101100101000101011011001' '2r01110010011110110010100110101101' '2r10101011101011001010000010110110' '2r10101000000000000000000000000000' '2r0010101110101001110010100000101101100010011110110010100010101100' '2r1010101110101100101000001011011000100111101100101000101011011001' '2r1010101110101000000000000000000000000000000000000000000000000000'). + trials do: [:bitSequence | | aNumber | - trials do: [:bitSequence | aNumber := Number readFrom: bitSequence. bitSequence2 := (bitSequence size - 2 to: 1 by: -1) inject: '2r' into: [:string :i | string copyWith: (Character digitValue: (aNumber bitAt: i))]. self assert: bitSequence2 = bitSequence]. + trials do: [:bitSequence | | bitInvert | - trials do: [:bitSequence | bitInvert := -1 - (Number readFrom: bitSequence). bitSequence2 := (bitSequence size - 2 to: 1 by: -1) inject: '2r' into: [:string :i | string copyWith: (Character digitValue: 1 - (bitInvert bitAt: i))]. self assert: bitSequence2 = bitSequence description: '-1-x is similar to a bitInvert operation in two complement']! Item was changed: ----- Method: InstVarRefLocatorTest>>testInstructions (in category 'tests') ----- testInstructions + - | scanner end printer | + Object methodDict do: [:method | | scanner printer end | - Object methodDict do: [:method | scanner := InstructionStream on: method. printer := InstVarRefLocator new. end := scanner method endPC. [scanner pc <= end] whileTrue: [ self shouldnt: [printer interpretNextInstructionUsing: scanner] raise: Error. ]. ].! Item was changed: ----- Method: InstructionClientTest>>testInstructions (in category 'tests') ----- testInstructions "just interpret all of methods of Object" + | client | - | client scanner | client := InstructionClient new. Object methodDict do: [:method | + | scanner | scanner := (InstructionStream on: method). [scanner pc <= method endPC] whileTrue: [ self shouldnt: [scanner interpretNextInstructionFor: client] raise: Error. ]. ]. ! |
Free forum by Nabble | Edit this page |