Panu,<br><br>Actually, firstElement and so on were additions to the particular test case to avoid using e.g. SequenceableCollection>>at: to test that SequenceableCollection>>at: works. For example,<br><br>testAt<br>
<br> | expectedResults |<br> expectedResults := #(1 4 9 16 25 36 49 64 81 100 121).<br> actualResults := (1 to: 11) collect: [:each | each squared].<br> 1 to: expectedResults size do:<br> [:eachIndex |<br> self assert: (expectedResults at: eachIndex) = (actualResults at: eachIndex)<br>
]<br><br><br>So, instead of that,<br><br>testAt<br><br> actualResults := (1 to: 11) collect: [:each | each squared].<br> self assert: (actualResults at: 1) = self firstExpectedResult.<br> self assert: (actualResults at: 2) = self secondExpectedResult.<br>
.<br> .<br> .<br><br><br>In the actual SUnit test suite, I think I dared up to fifthElement and such.<br><br>Andres.<br><br><div class="gmail_quote">On Feb 2, 2008 8:20 PM, Panu Logic <<a href="mailto:panulogic@gmail.com">panulogic@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Andres Valloud wrote:<br>> At one point I wrote an SUnit ANSI test suite for collections.<br>
> Something I noticed is that it is quite easy to depend on the feature<br>> you want to test to write the test in the first place. Particularly<br>> when writing tests for things like Array or SortedCollection, the<br>
> dependency on at: and at:put: becomes obvious and the whole exercise<br>> appears to become a tautology.<br><br>Cycles in language-specifications can be avoided by writing the spec in<br>a language separate from the language being specified. No doubt any<br>
Smalltalk standard will need to rely on natural language. But if parts<br>of the spec can be written in Smalltalk itself, so much better, because<br>of the added rigor.<br><br>But consider English for a second. Its grammar is specified in English<br>
that's augmented with a few words that only make sense in the context of<br>the grammar ("verb", "noun", "plural" ...) - which are defined in terms<br>of the basic, everyday English. Similarly what you seem to be<br>
proposing is "augmenting" Collections with constructs whose sole<br>purpose is to aid in writing the '"standard": #firstElement,<br>#secondElement, etc.<br><br>I see no problem with this. It makes sense from the viewpoint that<br>
natural language standards are required to use similar means in their<br>standards.<br><br>-Panu Viljamaa<br><div><div></div><div class="Wj3C7c"><br><br><br><br>_______________________________________________<br>ANSI-Smalltalk mailing list<br>
<a href="mailto:ANSI-Smalltalk@lists.openskills.org">ANSI-Smalltalk@lists.openskills.org</a><br><a href="http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk" target="_blank">http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk</a><br>
</div></div></blockquote></div><br>