[squeak-dev] The Trunk: CollectionsTests-nice.304.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Apr 6 13:55:44 UTC 2019
Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.304.mcz
==================== Summary ====================
Name: CollectionsTests-nice.304
Author: nice
Time: 6 April 2019, 3:55:40.624272 pm
UUID: e6dfc4bf-906d-4e7d-8bb4-1fc6fc5bbe4b
Ancestors: CollectionsTests-ul.303
More and less Interval tests
- Once upon a time, I changed reversed to answer an Interval, which is a good thing...
Err, except for Interval of floats (which are generally not well behaved objects)...
I don't know if we must revert reversed, or hack special case of Float Intervals (I have some idea), but we should at least document the behavior.
- Once upon a time, I fixed implementation of fuzzy inclusion in Interval. But I don't really approve the feature.
Fuzzy inclusion produce several unconsistencies in Interval behavior which goes against a principle of least astonishment.
As we say, you can cheat as long as you don't get caught... Gotcha!
- Remove testNumericTypes which does not assert anything, which seems to ignore the basics of Smalltalk selector precedence, and which would rely on abandoned equality between Interval and Array.
=============== Diff against CollectionsTests-ul.303 ===============
Item was added:
+ ----- Method: IntervalTest>>testIntervalOfFloatReversed (in category 'tests') -----
+ testIntervalOfFloatReversed
+ self assert: (-16.3 to: 20.1 by: 1.3) reversed size
+ equals: (-16.3 to: 20.1 by: 1.3) size
+ description: 'reversed should preserve the size of a collection'.
+ self assert: (0.1 to: 0.9 by: 0.1) reversed asArray
+ equals: (0.1 to: 0.9 by: 0.1) asArray reversed
+ description: 'reversed should preserve the elements of a collection'.!
Item was removed:
- ----- Method: IntervalTest>>testNumericTypes (in category 'tests') -----
- testNumericTypes
-
- (3 asNumber) to: 5 = #(3 4 5).
-
- 3.0 to: 5.0 = #(3.0 4.0 5.0).
- 3.0 to: 5.0 by: 0.5 = #(3.0 3.5 4.0 4.5 5.0).
-
- 3/1 to: 5/1 = #(3 4 5).
- 1/2 to: 5/2 by: 1/2 = #(1/2 1 3/2 2 5/2).!
Item was added:
+ ----- Method: IntervalTest>>testSurprisingFuzzyInclusionBehavior (in category 'tests') -----
+ testSurprisingFuzzyInclusionBehavior
+ "If ever Interval implement fuzzy inclusion, then we can expect weird logic..."
+ self assert: ((0.1 to: 0.9 by: 0.1) asArray includes: 0.3)
+ ==> (((0.1 to: 0.9 by: 0.1) occurrencesOf: 0.3) > 0)
+ description: 'A Collection that includes something has at least one occurrence of something'.
+ self assert: ((0.1 to: 0.9 by: 0.1) lastIndexOf: 0.3)
+ >= ((0.1 to: 0.9 by: 0.1) indexOf: 0.3)
+ description: 'If the last index of an object in a SequenceableCollection should be greater or equal to the first index'.!
More information about the Squeak-dev
mailing list
|