[ANSI-Smalltalk] squeakers

Andres Valloud andres.valloud at gmail.com
Mon Feb 4 03:42:12 GMT 2008


Panu,

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,

testAt

  | expectedResults |
  expectedResults := #(1 4 9 16 25 36 49 64 81 100 121).
  actualResults := (1 to: 11) collect: [:each | each squared].
  1 to: expectedResults size do:
    [:eachIndex |
      self assert: (expectedResults at: eachIndex) = (actualResults at:
eachIndex)
    ]


So, instead of that,

testAt

    actualResults := (1 to: 11) collect: [:each | each squared].
    self assert: (actualResults at: 1) = self firstExpectedResult.
    self assert: (actualResults at: 2) = self secondExpectedResult.
    .
    .
    .


In the actual SUnit test suite, I think I dared up to fifthElement and such.

Andres.

On Feb 2, 2008 8:20 PM, Panu Logic <panulogic at gmail.com> wrote:

> Andres Valloud wrote:
> > At one point I wrote an SUnit ANSI test suite for collections.
> > Something I noticed is that it is quite easy to depend on the feature
> > you want to test to write the test in the first place.  Particularly
> > when writing tests for things like Array or SortedCollection, the
> > dependency on at: and at:put: becomes obvious and the whole exercise
> > appears to become a tautology.
>
> Cycles in language-specifications can be avoided by writing the spec in
> a  language separate from the language being specified. No doubt any
> Smalltalk standard will need to rely on natural language.  But if parts
> of the spec can be written in Smalltalk itself, so much better, because
> of the  added rigor.
>
> But consider English for a second.  Its grammar is specified in English
> that's augmented with a few words that only make sense in the context of
> the grammar ("verb", "noun", "plural" ...) - which are defined in terms
> of the basic, everyday English.   Similarly what you seem to be
> proposing is "augmenting"   Collections with constructs whose sole
> purpose is to aid in writing the '"standard":  #firstElement,
> #secondElement,  etc.
>
> I see no problem with this.  It makes sense from the viewpoint that
> natural language standards are required to use similar means in their
> standards.
>
> -Panu Viljamaa
>
>
>
>
> _______________________________________________
> ANSI-Smalltalk mailing list
> ANSI-Smalltalk at lists.openskills.org
> http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openskills.org/pipermail/ansi-smalltalk/attachments/20080203/7c143cce/attachment.htm


More information about the ANSI-Smalltalk mailing list