The Trunk: CollectionsTests-mt.229.mcz

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

The Trunk: CollectionsTests-mt.229.mcz

commits-2
Marcel Taeumel uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-mt.229.mcz

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

Name: CollectionsTests-mt.229
Author: mt
Time: 15 January 2015, 5:15:23.643 pm
UUID: 5ed2aee8-4067-2945-8655-f1b218b95bfb
Ancestors: CollectionsTests-mt.228

tests for ordered dictionary added

=============== Diff against CollectionsTests-mt.228 ===============

Item was added:
+ ClassTestCase subclass: #OrderedDictionaryTest
+ instanceVariableNames: 'sut'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'CollectionsTests-Sequenceable'!

Item was added:
+ ----- Method: OrderedDictionaryTest>>setUp (in category 'running') -----
+ setUp
+
+ super setUp.
+ sut := OrderedDictionary new: 7.!

Item was added:
+ ----- Method: OrderedDictionaryTest>>testCompact (in category 'tests') -----
+ testCompact
+
+ | oldCapacity |
+ 1 to: 3 do: [:ea |
+ sut at: ea put: nil].
+ self assert: sut size equals: (sut instVarNamed: #lastIndex).
+
+ sut removeKey: 2.
+ self assert: sut size equals: (sut instVarNamed: #lastIndex) - 1.
+
+ oldCapacity := sut capacity.
+ 4 to: 20 do: [:ea |
+ sut at: ea put: nil].
+ self
+ assert: sut capacity > oldCapacity;
+ assert: sut size equals: (sut instVarNamed: #lastIndex).
+ !

Item was added:
+ ----- Method: OrderedDictionaryTest>>testGrow (in category 'tests') -----
+ testGrow
+
+ self
+ assert: 11 equals: sut capacity; "next prime number to 7; see #setUp"
+ assert: sut capacity equals: (sut instVarNamed: #order) size.
+
+ 1 to: sut capacity do: [:ea |
+ sut at: ea put: nil].
+
+ self
+ assert: sut capacity > 11;
+ assert: sut capacity equals: (sut instVarNamed: #order) size.!

Item was added:
+ ----- Method: OrderedDictionaryTest>>testOrder (in category 'tests') -----
+ testOrder
+ "We use integers as keys to match hash values."
+
+ | dict |
+ dict := Dictionary new.
+
+ 1 to: 10 do: [:ea |
+ dict at: ea put: nil.
+ sut at: ea put: nil].
+
+ self assert: dict keys = sut keys.
+
+ dict removeKey: 5.
+ sut removeKey: 5.
+
+ self assert: dict keys = sut keys.
+
+ dict at: 5 put: nil.
+ sut at: 5 put: nil.
+
+ self
+ assert: dict keys ~= sut keys;
+ assert: #(1 2 3 4 6 7 8 9 10 5) equals: sut keys;
+ assert: #(1 2 3 4 5 6 7 8 9 10) equals: dict keys.!

Item was added:
+ ----- Method: OrderedDictionaryTest>>testOverflow (in category 'tests') -----
+ testOverflow
+ "Check whether repeated additions of the same alternating keys causes an error."
+
+ self
+ shouldnt: [20 timesRepeat: [sut at: 1 put: nil. sut at: 2 put: nil]]
+ raise: Error. !

Item was added:
+ ----- Method: OrderedDictionaryTest>>testOverwriteValue (in category 'tests') -----
+ testOverwriteValue
+
+ 1 to: 5 do: [:ea |
+ sut at: ea put: nil].
+
+ sut at: 3 put: nil.
+
+ self assert: #(1 2 4 5 3) equals: sut keys.!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: CollectionsTests-mt.229.mcz

Frank Shearar-3
On 15 January 2015 at 16:15,  <[hidden email]> wrote:

> Marcel Taeumel uploaded a new version of CollectionsTests to project The Trunk:
> http://source.squeak.org/trunk/CollectionsTests-mt.229.mcz
>
> ==================== Summary ====================
>
> Name: CollectionsTests-mt.229
> Author: mt
> Time: 15 January 2015, 5:15:23.643 pm
> UUID: 5ed2aee8-4067-2945-8655-f1b218b95bfb
> Ancestors: CollectionsTests-mt.228
>
> tests for ordered dictionary added
>
> =============== Diff against CollectionsTests-mt.228 ===============
>
<snip>
> +       self assert: sut size equals: (sut instVarNamed: #lastIndex).

Nice! :)

frank