<div dir="ltr">Beside the form, isn't -1 a palindrome? (if you reverse bit/bytes you still get -1, so it's a poor value)<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/4 Frank Shearar <span dir="ltr"><<a href="mailto:frank.shearar@gmail.com" target="_blank">frank.shearar@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I really hate just having the lines under test just lying around like this:<br>
<br>
testByteArrayLongAt<br>
| ba value |<br>
<div class="im"> ba := ByteArray new: 4.<br>
</div> value := -1.<br>
ba longAt: 1 put: value bigEndian: true.<br>
<div class="im"> self assert: (ba longAt: 1 bigEndian: true) = value.<br>
</div> ba longAt: 1 put: value bigEndian: false.<br>
<div class="im"> self assert: (ba longAt: 1 bigEndian: false) = value.<br>
<br>
</div>I mean, it'd get the job done. Any better ideas?<br>
<br>
frank<br>
<br>
On 4 November 2013 21:51, Nicolas Cellier<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> wrote:<br>
> It does not cost to ask ;)<br>
> If you're in the mood and if our server is too, go for it...<br>
><br>
><br>
> 2013/11/4 Frank Shearar <<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>><br>
>><br>
>> Are you hinting that I should now fix the things post move? :)<br>
>><br>
>> frank<br>
>><br>
>> On 4 November 2013 21:15, Nicolas Cellier<br>
>> <<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> wrote:<br>
>> > Sure! I said while at it ;)<br>
>> ><br>
>> ><br>
>> > 2013/11/4 Frank Shearar <<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>><br>
>> >><br>
>> >> Yes. #shouldnt:raise: is evil when you catch Error.<br>
>> >><br>
>> >> I deliberately didn't do that here so that reviewers could see that I<br>
>> >> moved methods, not added some random new test.<br>
>> >><br>
>> >> frank<br>
>> >><br>
>> >> On 4 November 2013 20:56, Nicolas Cellier<br>
>> >> <<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> wrote:<br>
>> >> > While at it, there were a discussion in Pharo about shouldnt: []<br>
>> >> > raise:<br>
>> >> > Error, and it's generally considered a poor test<br>
>> >> > - practically nothing should raise Error, unless in the few cases<br>
>> >> > when<br>
>> >> > you<br>
>> >> > create a block that should:raise:<br>
>> >> > so should:raise: is usefull, but shouldnt:raise: is generally<br>
>> >> > useless<br>
>> >> > (unless maybe if you are testing an Error inhibition mechanism with<br>
>> >> > a<br>
>> >> > block that shouldNormally:raise: Error)<br>
>> >> > - if ever, it effectively raises an Error, you have no information<br>
>> >> > why<br>
>> >> > I fully agree with this.<br>
>> >> ><br>
>> >> ><br>
>> >> > 2013/11/4 <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>><br>
>> >> ><br>
>> >> >> Frank Shearar uploaded a new version of CollectionsTests to project<br>
>> >> >> The<br>
>> >> >> Trunk:<br>
>> >> >> <a href="http://source.squeak.org/trunk/CollectionsTests-fbs.207.mcz" target="_blank">http://source.squeak.org/trunk/CollectionsTests-fbs.207.mcz</a><br>
>> >> >><br>
>> >> >> ==================== Summary ====================<br>
>> >> >><br>
>> >> >> Name: CollectionsTests-fbs.207<br>
>> >> >> Author: fbs<br>
>> >> >> Time: 4 November 2013, 6:31:01.83 pm<br>
>> >> >> UUID: 4057d67b-5969-8b41-85d1-43fd39da4bb1<br>
>> >> >> Ancestors: CollectionsTests-cmm.206<br>
>> >> >><br>
>> >> >> Move collection tests where they belong.<br>
>> >> >><br>
>> >> >> =============== Diff against CollectionsTests-cmm.206<br>
>> >> >> ===============<br>
>> >> >><br>
>> >> >> Item was added:<br>
>> >> >> + ----- Method: ByteArrayTest>>testByteArrayLongAt (in category 'as<br>
>> >> >> yet<br>
>> >> >> unclassified') -----<br>
>> >> >> + testByteArrayLongAt<br>
>> >> >> + | ba value |<br>
>> >> >> + ba := ByteArray new: 4.<br>
>> >> >> + value := -1.<br>
>> >> >> + self shouldnt:[ba longAt: 1 put: value bigEndian: true]<br>
>> >> >> raise:<br>
>> >> >> Error.<br>
>> >> >> + self assert: (ba longAt: 1 bigEndian: true) = value.<br>
>> >> >> + self shouldnt:[ba longAt: 1 put: value bigEndian: false]<br>
>> >> >> raise:<br>
>> >> >> Error.<br>
>> >> >> + self assert: (ba longAt: 1 bigEndian: false) = value.!<br>
>> >> >><br>
>> >> >> Item was added:<br>
>> >> >> + ----- Method: DictionaryTest>>testIntegrityOfDictionaries (in<br>
>> >> >> category<br>
>> >> >> 'integrity tests') -----<br>
>> >> >> + testIntegrityOfDictionaries<br>
>> >> >> + #(<br>
>> >> >> + Dictionary<br>
>> >> >> + IdentityDictionary<br>
>> >> >> + SystemDictionary<br>
>> >> >> + LiteralDictionary<br>
>> >> >> + PluggableDictionary<br>
>> >> >> + WeakValueDictionary) do: [ :dictionaryClassName |<br>
>> >> >> + Smalltalk at: dictionaryClassName ifPresent:<br>
>> >> >> [<br>
>> >> >> :dictionaryClass |<br>
>> >> >> + dictionaryClass allInstancesDo: [<br>
>> >> >> :dictionary |<br>
>> >> >> + dictionary keysAndValuesDo:<br>
>> >> >> [<br>
>> >> >> :key<br>
>> >> >> :value |<br>
>> >> >> + self assert:<br>
>> >> >> (dictionary<br>
>> >> >> at: key) == value ].<br>
>> >> >> + dictionary array<br>
>> >> >> doWithIndex: [<br>
>> >> >> :association :index |<br>
>> >> >> + association ifNotNil: [<br>
>> >> >> + self assert:<br>
>> >> >> (dictionary<br>
>> >> >> scanFor: association key) = index ] ] ] ] ]!<br>
>> >> >><br>
>> >> >> Item was added:<br>
>> >> >> + ----- Method: DictionaryTest>>testMethodDictionaries (in category<br>
>> >> >> 'integrity tests') -----<br>
>> >> >> + testMethodDictionaries<br>
>> >> >> + MethodDictionary allInstancesDo: [ :dictionary |<br>
>> >> >> + dictionary keysAndValuesDo: [ :key :value |<br>
>> >> >> + self assert: (dictionary at: key) == value<br>
>> >> >> ].<br>
>> >> >> + 1 to: dictionary basicSize do: [ :index |<br>
>> >> >> + (dictionary basicAt: index)<br>
>> >> >> + ifNil: [ self assert: (dictionary<br>
>> >> >> array<br>
>> >> >> at: index) isNil ]<br>
>> >> >> + ifNotNil: [ :key |<br>
>> >> >> + self assert: (dictionary<br>
>> >> >> scanFor:<br>
>> >> >> key) = index ] ] ]!<br>
>> >> >><br>
>> >> >> Item was added:<br>
>> >> >> + ----- Method: HashedCollectionTest>>testCapacity (in category<br>
>> >> >> 'test -<br>
>> >> >> integrity') -----<br>
>> >> >> + testCapacity<br>
>> >> >> +<br>
>> >> >> + | inconsistentCollections |<br>
>> >> >> + inconsistentCollections := HashedCollection allSubInstances<br>
>> >> >> reject: [ :each |<br>
>> >> >> + each class == MethodDictionary "MethodDictionary is<br>
>> >> >> the<br>
>> >> >> only HashedCollection which doesn't have prime array size"<br>
>> >> >> + ifTrue: [ each capacity isPowerOfTwo ]<br>
>> >> >> + ifFalse: [ each capacity isPrime ] ].<br>
>> >> >> + self assert: inconsistentCollections isEmpty!<br>
>> >> >><br>
>> >> >> Item was added:<br>
>> >> >> + ----- Method: ReadWriteStreamTest>>testReadWriteStreamNextNBug (in<br>
>> >> >> category 'tests') -----<br>
>> >> >> + testReadWriteStreamNextNBug<br>
>> >> >> + | aStream |<br>
>> >> >> + aStream := ReadWriteStream on: String new.<br>
>> >> >> + aStream nextPutAll: 'Hello World'.<br>
>> >> >> + self shouldnt:[aStream next: 5] raise: Error.!<br>
>> >> >><br>
>> >> >><br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>><br>
><br>
><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>