The Inbox: CollectionsTests-ct.321.mcz

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

The Inbox: CollectionsTests-ct.321.mcz

commits-2
A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-ct.321.mcz

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

Name: CollectionsTests-ct.321
Author: ct
Time: 27 September 2019, 4:15:21.022642 pm
UUID: 6638fd69-d57a-7e43-a99c-2d99b52a0b36
Ancestors: CollectionsTests-jr.320

Extend OrderedDictionaryTest >> #testCopyFromTo to reveal a bug

=============== Diff against CollectionsTests-jr.320 ===============

Item was changed:
  ----- Method: OrderedDictionaryTest>>testCopyFromTo (in category 'tests - copying') -----
  testCopyFromTo
 
+ | copy |
  1 to: 10 do: [:index |
  sut at: index put: nil].
 
+ copy := sut copyFrom: 3 to: 5.
+ self assert: (3 to: 5) asArray equals: copy keys.
+ copy at: 3 put: #foo.
+ self assert: (sut at: 3) isNil.
+
+ copy at: 11 put: #ba.
+ self assert: #ba equals: (copy at: 11).!
- (sut copyFrom: 3 to: 5) in: [:copy |
- self assert: (3 to: 5) asArray equals: copy keys.
- copy at: 3 put: #foo.
- self assert: (sut at: 3) isNil.].!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: CollectionsTests-ct.321.mcz

marcel.taeumel
I think you find a bug regarding the recent change in HashedCollection class >> #goodPrimes. Yet, what does this test do? A comment would be nice. :-) Same for Collections-ct.857 regarding that "array+1".

Best,
Marcel

Am 27.09.2019 16:15:30 schrieb [hidden email] <[hidden email]>:

A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-ct.321.mcz

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

Name: CollectionsTests-ct.321
Author: ct
Time: 27 September 2019, 4:15:21.022642 pm
UUID: 6638fd69-d57a-7e43-a99c-2d99b52a0b36
Ancestors: CollectionsTests-jr.320

Extend OrderedDictionaryTest >> #testCopyFromTo to reveal a bug

=============== Diff against CollectionsTests-jr.320 ===============

Item was changed:
----- Method: OrderedDictionaryTest>>testCopyFromTo (in category 'tests - copying') -----
testCopyFromTo

+ | copy |
1 to: 10 do: [:index |
sut at: index put: nil].

+ copy := sut copyFrom: 3 to: 5.
+ self assert: (3 to: 5) asArray equals: copy keys.
+ copy at: 3 put: #foo.
+ self assert: (sut at: 3) isNil.
+
+ copy at: 11 put: #ba.
+ self assert: #ba equals: (copy at: 11).!
- (sut copyFrom: 3 to: 5) in: [:copy |
- self assert: (3 to: 5) asArray equals: copy keys.
- copy at: 3 put: #foo.
- self assert: (sut at: 3) isNil.].!




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: CollectionsTests-ct.321.mcz

Christoph Thiede

Sorry for the missing explanation. The test now assures that it is possible to add a new item to the copied OrderedDictionary, without any error occurring.


In the current Trunk, this test fails because #copyFrom:to: does not reserve space for at least one nil item in order. This leads to an error when growing up the OrderedDictionary, because temporarily while running #atNewIndex:put:, tally is greater than order size.

As the class comment in HashedCollection states for array, that "there is always at least one nil", I think the same invariant should go for order in OrderedDictionary? Also, in OrderedDictionary >> #initialize: and OrderedDictionary >> #growTo:, the same "+ 1" is used for computing the order size.


I was not aware of #goodPrimes, but why should it be erroneous? They're all primes :)


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Freitag, 27. September 2019 16:28:36
An: Alan Grimes via Squeak-dev
Betreff: Re: [squeak-dev] The Inbox: CollectionsTests-ct.321.mcz
 
I think you find a bug regarding the recent change in HashedCollection class >> #goodPrimes. Yet, what does this test do? A comment would be nice. :-) Same for Collections-ct.857 regarding that "array+1".

Best,
Marcel

Am 27.09.2019 16:15:30 schrieb [hidden email] <[hidden email]>:

A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-ct.321.mcz

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

Name: CollectionsTests-ct.321
Author: ct
Time: 27 September 2019, 4:15:21.022642 pm
UUID: 6638fd69-d57a-7e43-a99c-2d99b52a0b36
Ancestors: CollectionsTests-jr.320

Extend OrderedDictionaryTest >> #testCopyFromTo to reveal a bug

=============== Diff against CollectionsTests-jr.320 ===============

Item was changed:
----- Method: OrderedDictionaryTest>>testCopyFromTo (in category 'tests - copying') -----
testCopyFromTo

+ | copy |
1 to: 10 do: [:index |
sut at: index put: nil].

+ copy := sut copyFrom: 3 to: 5.
+ self assert: (3 to: 5) asArray equals: copy keys.
+ copy at: 3 put: #foo.
+ self assert: (sut at: 3) isNil.
+
+ copy at: 11 put: #ba.
+ self assert: #ba equals: (copy at: 11).!
- (sut copyFrom: 3 to: 5) in: [:copy |
- self assert: (3 to: 5) asArray equals: copy keys.
- copy at: 3 put: #foo.
- self assert: (sut at: 3) isNil.].!




Carpe Squeak!