Frank Shearar uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-fbs.207.mcz ==================== Summary ==================== Name: CollectionsTests-fbs.207 Author: fbs Time: 4 November 2013, 6:31:01.83 pm UUID: 4057d67b-5969-8b41-85d1-43fd39da4bb1 Ancestors: CollectionsTests-cmm.206 Move collection tests where they belong. =============== Diff against CollectionsTests-cmm.206 =============== Item was added: + ----- Method: ByteArrayTest>>testByteArrayLongAt (in category 'as yet unclassified') ----- + testByteArrayLongAt + | ba value | + ba := ByteArray new: 4. + value := -1. + self shouldnt:[ba longAt: 1 put: value bigEndian: true] raise: Error. + self assert: (ba longAt: 1 bigEndian: true) = value. + self shouldnt:[ba longAt: 1 put: value bigEndian: false] raise: Error. + self assert: (ba longAt: 1 bigEndian: false) = value.! Item was added: + ----- Method: DictionaryTest>>testIntegrityOfDictionaries (in category 'integrity tests') ----- + testIntegrityOfDictionaries + #( + Dictionary + IdentityDictionary + SystemDictionary + LiteralDictionary + PluggableDictionary + WeakValueDictionary) do: [ :dictionaryClassName | + Smalltalk at: dictionaryClassName ifPresent: [ :dictionaryClass | + dictionaryClass allInstancesDo: [ :dictionary | + dictionary keysAndValuesDo: [ :key :value | + self assert: (dictionary at: key) == value ]. + dictionary array doWithIndex: [ :association :index | + association ifNotNil: [ + self assert: (dictionary scanFor: association key) = index ] ] ] ] ]! Item was added: + ----- Method: DictionaryTest>>testMethodDictionaries (in category 'integrity tests') ----- + testMethodDictionaries + MethodDictionary allInstancesDo: [ :dictionary | + dictionary keysAndValuesDo: [ :key :value | + self assert: (dictionary at: key) == value ]. + 1 to: dictionary basicSize do: [ :index | + (dictionary basicAt: index) + ifNil: [ self assert: (dictionary array at: index) isNil ] + ifNotNil: [ :key | + self assert: (dictionary scanFor: key) = index ] ] ]! Item was added: + ----- Method: HashedCollectionTest>>testCapacity (in category 'test - integrity') ----- + testCapacity + + | inconsistentCollections | + inconsistentCollections := HashedCollection allSubInstances reject: [ :each | + each class == MethodDictionary "MethodDictionary is the only HashedCollection which doesn't have prime array size" + ifTrue: [ each capacity isPowerOfTwo ] + ifFalse: [ each capacity isPrime ] ]. + self assert: inconsistentCollections isEmpty! Item was added: + ----- Method: ReadWriteStreamTest>>testReadWriteStreamNextNBug (in category 'tests') ----- + testReadWriteStreamNextNBug + | aStream | + aStream := ReadWriteStream on: String new. + aStream nextPutAll: 'Hello World'. + self shouldnt:[aStream next: 5] raise: Error.! |
While at it, there were a discussion in Pharo about shouldnt: [] raise: Error, and it's generally considered a poor test - practically nothing should raise Error, unless in the few cases when you create a block that should:raise: so should:raise: is usefull, but shouldnt:raise: is generally useless - if ever, it effectively raises an Error, you have no information why(unless maybe if you are testing an Error inhibition mechanism with a block that shouldNormally:raise: Error) 2013/11/4 <[hidden email]> Frank Shearar uploaded a new version of CollectionsTests to project The Trunk: |
Yes. #shouldnt:raise: is evil when you catch Error.
I deliberately didn't do that here so that reviewers could see that I moved methods, not added some random new test. frank On 4 November 2013 20:56, Nicolas Cellier <[hidden email]> wrote: > While at it, there were a discussion in Pharo about shouldnt: [] raise: > Error, and it's generally considered a poor test > - practically nothing should raise Error, unless in the few cases when you > create a block that should:raise: > so should:raise: is usefull, but shouldnt:raise: is generally useless > (unless maybe if you are testing an Error inhibition mechanism with a > block that shouldNormally:raise: Error) > - if ever, it effectively raises an Error, you have no information why > I fully agree with this. > > > 2013/11/4 <[hidden email]> > >> Frank Shearar uploaded a new version of CollectionsTests to project The >> Trunk: >> http://source.squeak.org/trunk/CollectionsTests-fbs.207.mcz >> >> ==================== Summary ==================== >> >> Name: CollectionsTests-fbs.207 >> Author: fbs >> Time: 4 November 2013, 6:31:01.83 pm >> UUID: 4057d67b-5969-8b41-85d1-43fd39da4bb1 >> Ancestors: CollectionsTests-cmm.206 >> >> Move collection tests where they belong. >> >> =============== Diff against CollectionsTests-cmm.206 =============== >> >> Item was added: >> + ----- Method: ByteArrayTest>>testByteArrayLongAt (in category 'as yet >> unclassified') ----- >> + testByteArrayLongAt >> + | ba value | >> + ba := ByteArray new: 4. >> + value := -1. >> + self shouldnt:[ba longAt: 1 put: value bigEndian: true] raise: >> Error. >> + self assert: (ba longAt: 1 bigEndian: true) = value. >> + self shouldnt:[ba longAt: 1 put: value bigEndian: false] raise: >> Error. >> + self assert: (ba longAt: 1 bigEndian: false) = value.! >> >> Item was added: >> + ----- Method: DictionaryTest>>testIntegrityOfDictionaries (in category >> 'integrity tests') ----- >> + testIntegrityOfDictionaries >> + #( >> + Dictionary >> + IdentityDictionary >> + SystemDictionary >> + LiteralDictionary >> + PluggableDictionary >> + WeakValueDictionary) do: [ :dictionaryClassName | >> + Smalltalk at: dictionaryClassName ifPresent: [ >> :dictionaryClass | >> + dictionaryClass allInstancesDo: [ >> :dictionary | >> + dictionary keysAndValuesDo: [ :key >> :value | >> + self assert: (dictionary >> at: key) == value ]. >> + dictionary array doWithIndex: [ >> :association :index | >> + association ifNotNil: [ >> + self assert: (dictionary >> scanFor: association key) = index ] ] ] ] ]! >> >> Item was added: >> + ----- Method: DictionaryTest>>testMethodDictionaries (in category >> 'integrity tests') ----- >> + testMethodDictionaries >> + MethodDictionary allInstancesDo: [ :dictionary | >> + dictionary keysAndValuesDo: [ :key :value | >> + self assert: (dictionary at: key) == value ]. >> + 1 to: dictionary basicSize do: [ :index | >> + (dictionary basicAt: index) >> + ifNil: [ self assert: (dictionary array >> at: index) isNil ] >> + ifNotNil: [ :key | >> + self assert: (dictionary scanFor: >> key) = index ] ] ]! >> >> Item was added: >> + ----- Method: HashedCollectionTest>>testCapacity (in category 'test - >> integrity') ----- >> + testCapacity >> + >> + | inconsistentCollections | >> + inconsistentCollections := HashedCollection allSubInstances >> reject: [ :each | >> + each class == MethodDictionary "MethodDictionary is the >> only HashedCollection which doesn't have prime array size" >> + ifTrue: [ each capacity isPowerOfTwo ] >> + ifFalse: [ each capacity isPrime ] ]. >> + self assert: inconsistentCollections isEmpty! >> >> Item was added: >> + ----- Method: ReadWriteStreamTest>>testReadWriteStreamNextNBug (in >> category 'tests') ----- >> + testReadWriteStreamNextNBug >> + | aStream | >> + aStream := ReadWriteStream on: String new. >> + aStream nextPutAll: 'Hello World'. >> + self shouldnt:[aStream next: 5] raise: Error.! >> >> > > > > |
Sure! I said while at it ;) 2013/11/4 Frank Shearar <[hidden email]> Yes. #shouldnt:raise: is evil when you catch Error. |
Are you hinting that I should now fix the things post move? :)
frank On 4 November 2013 21:15, Nicolas Cellier <[hidden email]> wrote: > Sure! I said while at it ;) > > > 2013/11/4 Frank Shearar <[hidden email]> >> >> Yes. #shouldnt:raise: is evil when you catch Error. >> >> I deliberately didn't do that here so that reviewers could see that I >> moved methods, not added some random new test. >> >> frank >> >> On 4 November 2013 20:56, Nicolas Cellier >> <[hidden email]> wrote: >> > While at it, there were a discussion in Pharo about shouldnt: [] raise: >> > Error, and it's generally considered a poor test >> > - practically nothing should raise Error, unless in the few cases when >> > you >> > create a block that should:raise: >> > so should:raise: is usefull, but shouldnt:raise: is generally useless >> > (unless maybe if you are testing an Error inhibition mechanism with a >> > block that shouldNormally:raise: Error) >> > - if ever, it effectively raises an Error, you have no information why >> > I fully agree with this. >> > >> > >> > 2013/11/4 <[hidden email]> >> > >> >> Frank Shearar uploaded a new version of CollectionsTests to project The >> >> Trunk: >> >> http://source.squeak.org/trunk/CollectionsTests-fbs.207.mcz >> >> >> >> ==================== Summary ==================== >> >> >> >> Name: CollectionsTests-fbs.207 >> >> Author: fbs >> >> Time: 4 November 2013, 6:31:01.83 pm >> >> UUID: 4057d67b-5969-8b41-85d1-43fd39da4bb1 >> >> Ancestors: CollectionsTests-cmm.206 >> >> >> >> Move collection tests where they belong. >> >> >> >> =============== Diff against CollectionsTests-cmm.206 =============== >> >> >> >> Item was added: >> >> + ----- Method: ByteArrayTest>>testByteArrayLongAt (in category 'as yet >> >> unclassified') ----- >> >> + testByteArrayLongAt >> >> + | ba value | >> >> + ba := ByteArray new: 4. >> >> + value := -1. >> >> + self shouldnt:[ba longAt: 1 put: value bigEndian: true] raise: >> >> Error. >> >> + self assert: (ba longAt: 1 bigEndian: true) = value. >> >> + self shouldnt:[ba longAt: 1 put: value bigEndian: false] raise: >> >> Error. >> >> + self assert: (ba longAt: 1 bigEndian: false) = value.! >> >> >> >> Item was added: >> >> + ----- Method: DictionaryTest>>testIntegrityOfDictionaries (in >> >> category >> >> 'integrity tests') ----- >> >> + testIntegrityOfDictionaries >> >> + #( >> >> + Dictionary >> >> + IdentityDictionary >> >> + SystemDictionary >> >> + LiteralDictionary >> >> + PluggableDictionary >> >> + WeakValueDictionary) do: [ :dictionaryClassName | >> >> + Smalltalk at: dictionaryClassName ifPresent: [ >> >> :dictionaryClass | >> >> + dictionaryClass allInstancesDo: [ >> >> :dictionary | >> >> + dictionary keysAndValuesDo: [ >> >> :key >> >> :value | >> >> + self assert: >> >> (dictionary >> >> at: key) == value ]. >> >> + dictionary array doWithIndex: [ >> >> :association :index | >> >> + association ifNotNil: [ >> >> + self assert: (dictionary >> >> scanFor: association key) = index ] ] ] ] ]! >> >> >> >> Item was added: >> >> + ----- Method: DictionaryTest>>testMethodDictionaries (in category >> >> 'integrity tests') ----- >> >> + testMethodDictionaries >> >> + MethodDictionary allInstancesDo: [ :dictionary | >> >> + dictionary keysAndValuesDo: [ :key :value | >> >> + self assert: (dictionary at: key) == value ]. >> >> + 1 to: dictionary basicSize do: [ :index | >> >> + (dictionary basicAt: index) >> >> + ifNil: [ self assert: (dictionary array >> >> at: index) isNil ] >> >> + ifNotNil: [ :key | >> >> + self assert: (dictionary >> >> scanFor: >> >> key) = index ] ] ]! >> >> >> >> Item was added: >> >> + ----- Method: HashedCollectionTest>>testCapacity (in category 'test - >> >> integrity') ----- >> >> + testCapacity >> >> + >> >> + | inconsistentCollections | >> >> + inconsistentCollections := HashedCollection allSubInstances >> >> reject: [ :each | >> >> + each class == MethodDictionary "MethodDictionary is the >> >> only HashedCollection which doesn't have prime array size" >> >> + ifTrue: [ each capacity isPowerOfTwo ] >> >> + ifFalse: [ each capacity isPrime ] ]. >> >> + self assert: inconsistentCollections isEmpty! >> >> >> >> Item was added: >> >> + ----- Method: ReadWriteStreamTest>>testReadWriteStreamNextNBug (in >> >> category 'tests') ----- >> >> + testReadWriteStreamNextNBug >> >> + | aStream | >> >> + aStream := ReadWriteStream on: String new. >> >> + aStream nextPutAll: 'Hello World'. >> >> + self shouldnt:[aStream next: 5] raise: Error.! >> >> >> >> >> > >> > >> > >> > >> > > > > |
It does not cost to ask ;) If you're in the mood and if our server is too, go for it... 2013/11/4 Frank Shearar <[hidden email]> Are you hinting that I should now fix the things post move? :) |
I really hate just having the lines under test just lying around like this:
testByteArrayLongAt | ba value | ba := ByteArray new: 4. value := -1. ba longAt: 1 put: value bigEndian: true. self assert: (ba longAt: 1 bigEndian: true) = value. ba longAt: 1 put: value bigEndian: false. self assert: (ba longAt: 1 bigEndian: false) = value. I mean, it'd get the job done. Any better ideas? frank On 4 November 2013 21:51, Nicolas Cellier <[hidden email]> wrote: > It does not cost to ask ;) > If you're in the mood and if our server is too, go for it... > > > 2013/11/4 Frank Shearar <[hidden email]> >> >> Are you hinting that I should now fix the things post move? :) >> >> frank >> >> On 4 November 2013 21:15, Nicolas Cellier >> <[hidden email]> wrote: >> > Sure! I said while at it ;) >> > >> > >> > 2013/11/4 Frank Shearar <[hidden email]> >> >> >> >> Yes. #shouldnt:raise: is evil when you catch Error. >> >> >> >> I deliberately didn't do that here so that reviewers could see that I >> >> moved methods, not added some random new test. >> >> >> >> frank >> >> >> >> On 4 November 2013 20:56, Nicolas Cellier >> >> <[hidden email]> wrote: >> >> > While at it, there were a discussion in Pharo about shouldnt: [] >> >> > raise: >> >> > Error, and it's generally considered a poor test >> >> > - practically nothing should raise Error, unless in the few cases >> >> > when >> >> > you >> >> > create a block that should:raise: >> >> > so should:raise: is usefull, but shouldnt:raise: is generally >> >> > useless >> >> > (unless maybe if you are testing an Error inhibition mechanism with >> >> > a >> >> > block that shouldNormally:raise: Error) >> >> > - if ever, it effectively raises an Error, you have no information >> >> > why >> >> > I fully agree with this. >> >> > >> >> > >> >> > 2013/11/4 <[hidden email]> >> >> > >> >> >> Frank Shearar uploaded a new version of CollectionsTests to project >> >> >> The >> >> >> Trunk: >> >> >> http://source.squeak.org/trunk/CollectionsTests-fbs.207.mcz >> >> >> >> >> >> ==================== Summary ==================== >> >> >> >> >> >> Name: CollectionsTests-fbs.207 >> >> >> Author: fbs >> >> >> Time: 4 November 2013, 6:31:01.83 pm >> >> >> UUID: 4057d67b-5969-8b41-85d1-43fd39da4bb1 >> >> >> Ancestors: CollectionsTests-cmm.206 >> >> >> >> >> >> Move collection tests where they belong. >> >> >> >> >> >> =============== Diff against CollectionsTests-cmm.206 >> >> >> =============== >> >> >> >> >> >> Item was added: >> >> >> + ----- Method: ByteArrayTest>>testByteArrayLongAt (in category 'as >> >> >> yet >> >> >> unclassified') ----- >> >> >> + testByteArrayLongAt >> >> >> + | ba value | >> >> >> + ba := ByteArray new: 4. >> >> >> + value := -1. >> >> >> + self shouldnt:[ba longAt: 1 put: value bigEndian: true] >> >> >> raise: >> >> >> Error. >> >> >> + self assert: (ba longAt: 1 bigEndian: true) = value. >> >> >> + self shouldnt:[ba longAt: 1 put: value bigEndian: false] >> >> >> raise: >> >> >> Error. >> >> >> + self assert: (ba longAt: 1 bigEndian: false) = value.! >> >> >> >> >> >> Item was added: >> >> >> + ----- Method: DictionaryTest>>testIntegrityOfDictionaries (in >> >> >> category >> >> >> 'integrity tests') ----- >> >> >> + testIntegrityOfDictionaries >> >> >> + #( >> >> >> + Dictionary >> >> >> + IdentityDictionary >> >> >> + SystemDictionary >> >> >> + LiteralDictionary >> >> >> + PluggableDictionary >> >> >> + WeakValueDictionary) do: [ :dictionaryClassName | >> >> >> + Smalltalk at: dictionaryClassName ifPresent: >> >> >> [ >> >> >> :dictionaryClass | >> >> >> + dictionaryClass allInstancesDo: [ >> >> >> :dictionary | >> >> >> + dictionary keysAndValuesDo: >> >> >> [ >> >> >> :key >> >> >> :value | >> >> >> + self assert: >> >> >> (dictionary >> >> >> at: key) == value ]. >> >> >> + dictionary array >> >> >> doWithIndex: [ >> >> >> :association :index | >> >> >> + association ifNotNil: [ >> >> >> + self assert: >> >> >> (dictionary >> >> >> scanFor: association key) = index ] ] ] ] ]! >> >> >> >> >> >> Item was added: >> >> >> + ----- Method: DictionaryTest>>testMethodDictionaries (in category >> >> >> 'integrity tests') ----- >> >> >> + testMethodDictionaries >> >> >> + MethodDictionary allInstancesDo: [ :dictionary | >> >> >> + dictionary keysAndValuesDo: [ :key :value | >> >> >> + self assert: (dictionary at: key) == value >> >> >> ]. >> >> >> + 1 to: dictionary basicSize do: [ :index | >> >> >> + (dictionary basicAt: index) >> >> >> + ifNil: [ self assert: (dictionary >> >> >> array >> >> >> at: index) isNil ] >> >> >> + ifNotNil: [ :key | >> >> >> + self assert: (dictionary >> >> >> scanFor: >> >> >> key) = index ] ] ]! >> >> >> >> >> >> Item was added: >> >> >> + ----- Method: HashedCollectionTest>>testCapacity (in category >> >> >> 'test - >> >> >> integrity') ----- >> >> >> + testCapacity >> >> >> + >> >> >> + | inconsistentCollections | >> >> >> + inconsistentCollections := HashedCollection allSubInstances >> >> >> reject: [ :each | >> >> >> + each class == MethodDictionary "MethodDictionary is >> >> >> the >> >> >> only HashedCollection which doesn't have prime array size" >> >> >> + ifTrue: [ each capacity isPowerOfTwo ] >> >> >> + ifFalse: [ each capacity isPrime ] ]. >> >> >> + self assert: inconsistentCollections isEmpty! >> >> >> >> >> >> Item was added: >> >> >> + ----- Method: ReadWriteStreamTest>>testReadWriteStreamNextNBug (in >> >> >> category 'tests') ----- >> >> >> + testReadWriteStreamNextNBug >> >> >> + | aStream | >> >> >> + aStream := ReadWriteStream on: String new. >> >> >> + aStream nextPutAll: 'Hello World'. >> >> >> + self shouldnt:[aStream next: 5] raise: Error.! >> >> >> >> >> >> >> >> > >> >> > >> >> > >> >> > >> >> >> > >> > >> > >> > >> > > > > |
Beside the form, isn't -1 a palindrome? (if you reverse bit/bytes you still get -1, so it's a poor value) 2013/11/4 Frank Shearar <[hidden email]> I really hate just having the lines under test just lying around like this: |
Do I understand correctly that this test just shows that you can use a ByteArray to store ints in a endian aware way? If so, why did Andreas use -1, which wouldn't show an endian reversal? frank
|
Just a guess, but I think the test was written
to show that a particular bug had been fixed. Endian wasn't an
issue here - negative numbers were.
http://lists.squeakfoundation.org/pipermail/squeak-dev/2003-August/063928.html Cheers, Bob On 11/5/13 3:24 AM, Frank Shearar
wrote:
|
| ba value | At least, it should be named something like testThatByteArrayLongAtDoesPreserveSign.ba := ByteArray new: 4. value := -1. ba longAt: 1 put: value bigEndian: true. self assert: (ba longAt: 1 bigEndian: true) = (ba longAt: 1 bigEndian: false). Thanks Bob, that makes sense but intention can't be revealed without this context, so the code is not good enough. 2013/11/5 Bob Arning <[hidden email]>
|
Well, testThatByteArrayLongAtDoesPreserveSignAndDoesNotSignalAnError
since the original bug was that (ByteArray new: 4) longAt: 1 put: -1 bigEndian: true resulted in a walkback. Although I do wonder if we are not crossing over into the realm of too much information. Cheers, Bob On 11/5/13 6:33 AM, Nicolas Cellier
wrote:
|
I'd argue that "AndDoesNotSignalAnError" is implicit in all tests :)
I'm hacking on CollectionTests at the moment so I'll make this change. frank On 5 November 2013 11:52, Bob Arning <[hidden email]> wrote: > Well, testThatByteArrayLongAtDoesPreserveSignAndDoesNotSignalAnError > > since the original bug was that > > (ByteArray new: 4) longAt: 1 put: -1 bigEndian: true > > resulted in a walkback. Although I do wonder if we are not crossing over > into the realm of too much information. > > Cheers, > Bob > > > On 11/5/13 6:33 AM, Nicolas Cellier wrote: > > | ba value | > ba := ByteArray new: 4. > value := -1. > ba longAt: 1 put: value bigEndian: true. > self assert: (ba longAt: 1 bigEndian: true) = (ba longAt: 1 bigEndian: > false). > > Thanks Bob, that makes sense > but intention can't be revealed without this context, so the code is not > good enough. > > At least, it should be named something like > testThatByteArrayLongAtDoesPreserveSign. > > > > > > 2013/11/5 Bob Arning <[hidden email]> >> >> Just a guess, but I think the test was written to show that a particular >> bug had been fixed. Endian wasn't an issue here - negative numbers were. >> >> >> http://lists.squeakfoundation.org/pipermail/squeak-dev/2003-August/063928.html >> >> Cheers, >> Bob >> >> On 11/5/13 3:24 AM, Frank Shearar wrote: >> >> Do I understand correctly that this test just shows that you can use a >> ByteArray to store ints in a endian aware way? If so, why did Andreas use >> -1, which wouldn't show an endian reversal? >> >> frank >> >> On 04 Nov 2013, at 22:04, Nicolas Cellier >> <[hidden email]> wrote: >> >> Beside the form, isn't -1 a palindrome? (if you reverse bit/bytes you >> still get -1, so it's a poor value) >> >> >> 2013/11/4 Frank Shearar <[hidden email]> >>> >>> I really hate just having the lines under test just lying around like >>> this: >>> >>> testByteArrayLongAt >>> | ba value | >>> ba := ByteArray new: 4. >>> value := -1. >>> ba longAt: 1 put: value bigEndian: true. >>> self assert: (ba longAt: 1 bigEndian: true) = value. >>> ba longAt: 1 put: value bigEndian: false. >>> self assert: (ba longAt: 1 bigEndian: false) = value. >>> >>> I mean, it'd get the job done. Any better ideas? >>> >>> frank >>> >>> On 4 November 2013 21:51, Nicolas Cellier >>> <[hidden email]> wrote: >>> > It does not cost to ask ;) >>> > If you're in the mood and if our server is too, go for it... >>> > >>> > >>> > 2013/11/4 Frank Shearar <[hidden email]> >>> >> >>> >> Are you hinting that I should now fix the things post move? :) >>> >> >>> >> frank >>> >> >>> >> On 4 November 2013 21:15, Nicolas Cellier >>> >> <[hidden email]> wrote: >>> >> > Sure! I said while at it ;) >>> >> > >>> >> > >>> >> > 2013/11/4 Frank Shearar <[hidden email]> >>> >> >> >>> >> >> Yes. #shouldnt:raise: is evil when you catch Error. >>> >> >> >>> >> >> I deliberately didn't do that here so that reviewers could see that >>> >> >> I >>> >> >> moved methods, not added some random new test. >>> >> >> >>> >> >> frank >>> >> >> >>> >> >> On 4 November 2013 20:56, Nicolas Cellier >>> >> >> <[hidden email]> wrote: >>> >> >> > While at it, there were a discussion in Pharo about shouldnt: [] >>> >> >> > raise: >>> >> >> > Error, and it's generally considered a poor test >>> >> >> > - practically nothing should raise Error, unless in the few cases >>> >> >> > when >>> >> >> > you >>> >> >> > create a block that should:raise: >>> >> >> > so should:raise: is usefull, but shouldnt:raise: is generally >>> >> >> > useless >>> >> >> > (unless maybe if you are testing an Error inhibition mechanism >>> >> >> > with >>> >> >> > a >>> >> >> > block that shouldNormally:raise: Error) >>> >> >> > - if ever, it effectively raises an Error, you have no >>> >> >> > information >>> >> >> > why >>> >> >> > I fully agree with this. >>> >> >> > >>> >> >> > >>> >> >> > 2013/11/4 <[hidden email]> >>> >> >> > >>> >> >> >> Frank Shearar uploaded a new version of CollectionsTests to >>> >> >> >> project >>> >> >> >> The >>> >> >> >> Trunk: >>> >> >> >> http://source.squeak.org/trunk/CollectionsTests-fbs.207.mcz >>> >> >> >> >>> >> >> >> ==================== Summary ==================== >>> >> >> >> >>> >> >> >> Name: CollectionsTests-fbs.207 >>> >> >> >> Author: fbs >>> >> >> >> Time: 4 November 2013, 6:31:01.83 pm >>> >> >> >> UUID: 4057d67b-5969-8b41-85d1-43fd39da4bb1 >>> >> >> >> Ancestors: CollectionsTests-cmm.206 >>> >> >> >> >>> >> >> >> Move collection tests where they belong. >>> >> >> >> >>> >> >> >> =============== Diff against CollectionsTests-cmm.206 >>> >> >> >> =============== >>> >> >> >> >>> >> >> >> Item was added: >>> >> >> >> + ----- Method: ByteArrayTest>>testByteArrayLongAt (in category >>> >> >> >> 'as >>> >> >> >> yet >>> >> >> >> unclassified') ----- >>> >> >> >> + testByteArrayLongAt >>> >> >> >> + | ba value | >>> >> >> >> + ba := ByteArray new: 4. >>> >> >> >> + value := -1. >>> >> >> >> + self shouldnt:[ba longAt: 1 put: value bigEndian: true] >>> >> >> >> raise: >>> >> >> >> Error. >>> >> >> >> + self assert: (ba longAt: 1 bigEndian: true) = value. >>> >> >> >> + self shouldnt:[ba longAt: 1 put: value bigEndian: false] >>> >> >> >> raise: >>> >> >> >> Error. >>> >> >> >> + self assert: (ba longAt: 1 bigEndian: false) = value.! >>> >> >> >> >>> >> >> >> Item was added: >>> >> >> >> + ----- Method: DictionaryTest>>testIntegrityOfDictionaries (in >>> >> >> >> category >>> >> >> >> 'integrity tests') ----- >>> >> >> >> + testIntegrityOfDictionaries >>> >> >> >> + #( >>> >> >> >> + Dictionary >>> >> >> >> + IdentityDictionary >>> >> >> >> + SystemDictionary >>> >> >> >> + LiteralDictionary >>> >> >> >> + PluggableDictionary >>> >> >> >> + WeakValueDictionary) do: [ :dictionaryClassName >>> >> >> >> | >>> >> >> >> + Smalltalk at: dictionaryClassName >>> >> >> >> ifPresent: >>> >> >> >> [ >>> >> >> >> :dictionaryClass | >>> >> >> >> + dictionaryClass allInstancesDo: >>> >> >> >> [ >>> >> >> >> :dictionary | >>> >> >> >> + dictionary >>> >> >> >> keysAndValuesDo: >>> >> >> >> [ >>> >> >> >> :key >>> >> >> >> :value | >>> >> >> >> + self assert: >>> >> >> >> (dictionary >>> >> >> >> at: key) == value ]. >>> >> >> >> + dictionary array >>> >> >> >> doWithIndex: [ >>> >> >> >> :association :index | >>> >> >> >> + association ifNotNil: [ >>> >> >> >> + self assert: >>> >> >> >> (dictionary >>> >> >> >> scanFor: association key) = index ] ] ] ] ]! >>> >> >> >> >>> >> >> >> Item was added: >>> >> >> >> + ----- Method: DictionaryTest>>testMethodDictionaries (in >>> >> >> >> category >>> >> >> >> 'integrity tests') ----- >>> >> >> >> + testMethodDictionaries >>> >> >> >> + MethodDictionary allInstancesDo: [ :dictionary | >>> >> >> >> + dictionary keysAndValuesDo: [ :key :value | >>> >> >> >> + self assert: (dictionary at: key) == >>> >> >> >> value >>> >> >> >> ]. >>> >> >> >> + 1 to: dictionary basicSize do: [ :index | >>> >> >> >> + (dictionary basicAt: index) >>> >> >> >> + ifNil: [ self assert: >>> >> >> >> (dictionary >>> >> >> >> array >>> >> >> >> at: index) isNil ] >>> >> >> >> + ifNotNil: [ :key | >>> >> >> >> + self assert: (dictionary >>> >> >> >> scanFor: >>> >> >> >> key) = index ] ] ]! >>> >> >> >> >>> >> >> >> Item was added: >>> >> >> >> + ----- Method: HashedCollectionTest>>testCapacity (in category >>> >> >> >> 'test - >>> >> >> >> integrity') ----- >>> >> >> >> + testCapacity >>> >> >> >> + >>> >> >> >> + | inconsistentCollections | >>> >> >> >> + inconsistentCollections := HashedCollection >>> >> >> >> allSubInstances >>> >> >> >> reject: [ :each | >>> >> >> >> + each class == MethodDictionary "MethodDictionary >>> >> >> >> is >>> >> >> >> the >>> >> >> >> only HashedCollection which doesn't have prime array size" >>> >> >> >> + ifTrue: [ each capacity isPowerOfTwo ] >>> >> >> >> + ifFalse: [ each capacity isPrime ] ]. >>> >> >> >> + self assert: inconsistentCollections isEmpty! >>> >> >> >> >>> >> >> >> Item was added: >>> >> >> >> + ----- Method: ReadWriteStreamTest>>testReadWriteStreamNextNBug >>> >> >> >> (in >>> >> >> >> category 'tests') ----- >>> >> >> >> + testReadWriteStreamNextNBug >>> >> >> >> + | aStream | >>> >> >> >> + aStream := ReadWriteStream on: String new. >>> >> >> >> + aStream nextPutAll: 'Hello World'. >>> >> >> >> + self shouldnt:[aStream next: 5] raise: Error.! >>> >> >> >> >>> >> >> >> >>> >> >> > >>> >> >> > >>> >> >> > >>> >> >> > >>> >> >> >>> >> > >>> >> > >>> >> > >>> >> > >>> >> >>> > >>> > >>> > >>> > >>> >> >> >> >> >> >> >> >> > > > > > > > |
Free forum by Nabble | Edit this page |