The Trunk: KernelTests-dtl.276.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: KernelTests-dtl.276.mcz

commits-2
David T. Lewis uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-dtl.276.mcz

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

Name: KernelTests-dtl.276
Author: dtl
Time: 22 July 2014, 10:38:16.634 pm
UUID: f6128ad6-87e1-449f-b34d-23c4ae265462
Ancestors: KernelTests-eem.275

Add tests for digit access in large integers. Given a 20 byte large positive or negative integer, verify that digit length, digit at, and digit replacement produce the expected results.

=============== Diff against KernelTests-eem.275 ===============

Item was added:
+ ----- Method: LargeNegativeIntegerTest>>testDigitAt (in category 'tests') -----
+ testDigitAt
+
+ | lni |
+ lni := -114605103402541699037609980192546360895434064385.
+ 1 to: 20 do: [:i | | digit |
+ digit := lni digitAt: i.
+ self assert: i equals: digit]
+ !

Item was added:
+ ----- Method: LargeNegativeIntegerTest>>testDigitAtPut (in category 'tests') -----
+ testDigitAtPut
+
+ | lni |
+ lni := LargeNegativeInteger new: 20.
+ 1 to: 20 do: [:i | lni digitAt: i put: i].
+ self assert: -114605103402541699037609980192546360895434064385equals: lni
+ !

Item was added:
+ ----- Method: LargeNegativeIntegerTest>>testDigitLength (in category 'tests') -----
+ testDigitLength
+
+ | lni |
+ lni := -114605103402541699037609980192546360895434064385.
+ self assert: 20 equals: lni digitLength
+ !

Item was added:
+ ----- Method: LargeNegativeIntegerTest>>testReplaceFromToWithStartingAt (in category 'tests') -----
+ testReplaceFromToWithStartingAt
+
+ | lni20 lni7 |
+ lni20 := LargeNegativeInteger new: 20.
+ 1 to: 20 do: [:i | lni20 digitAt: i put: i].
+ lni7 := LargeNegativeInteger new: 7.
+ 1 to: 7 do: [:i | lni7 digitAt: i put: 11 - i].
+ lni20 replaceFrom: 6 to: 10 with: lni7 startingAt: 2.
+ "unmodified digits"
+ (1 to: 5) , (11 to: 20) do: [:e | | digit |
+ digit := lni20 digitAt: e.
+ self assert: e equals: digit].
+ "replaced digits"
+ 6 to: 10 do: [:e | | digit replacementDigit |
+ digit := lni20 digitAt: e.
+ replacementDigit := lni7 digitAt: e - 4.
+ self assert: replacementDigit equals: digit]
+ !

Item was added:
+ ----- Method: LargePositiveIntegerTest>>testDigitAt (in category 'tests') -----
+ testDigitAt
+
+ | lpi |
+ lpi := 114605103402541699037609980192546360895434064385.
+ 1 to: 20 do: [:i | | digit |
+ digit := lpi digitAt: i.
+ self assert: i equals: digit]
+ !

Item was added:
+ ----- Method: LargePositiveIntegerTest>>testDigitAtPut (in category 'tests') -----
+ testDigitAtPut
+
+ | lpi |
+ lpi := LargePositiveInteger new: 20.
+ 1 to: 20 do: [:i | lpi digitAt: i put: i].
+ self assert: 114605103402541699037609980192546360895434064385equals: lpi
+ !

Item was added:
+ ----- Method: LargePositiveIntegerTest>>testDigitLength (in category 'tests') -----
+ testDigitLength
+
+ | lpi |
+ lpi := 114605103402541699037609980192546360895434064385.
+ self assert: 20 equals: lpi digitLength
+ !

Item was added:
+ ----- Method: LargePositiveIntegerTest>>testReplaceFromToWithStartingAt (in category 'tests') -----
+ testReplaceFromToWithStartingAt
+
+ | lpi20 lpi7 |
+ lpi20 := LargePositiveInteger new: 20.
+ 1 to: 20 do: [:i | lpi20 digitAt: i put: i].
+ lpi7 := LargePositiveInteger new: 7.
+ 1 to: 7 do: [:i | lpi7 digitAt: i put: 11 - i].
+ lpi20 replaceFrom: 6 to: 10 with: lpi7 startingAt: 2.
+ "unmodified digits"
+ (1 to: 5) , (11 to: 20) do: [:e | | digit |
+ digit := lpi20 digitAt: e.
+ self assert: e equals: digit].
+ "replaced digits"
+ 6 to: 10 do: [:e | | digit replacementDigit |
+ digit := lpi20 digitAt: e.
+ replacementDigit := lpi7 digitAt: e - 4.
+ self assert: replacementDigit equals: digit]
+ !