GRIntervalTest #testCopyUpToLast and #testCopyUpTo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GRIntervalTest #testCopyUpToLast and #testCopyUpTo

Dale Henrichs
GRIntervalTest inherits both #testCopyUpToLast and #testCopyUpTo (so the
tests are shared amongst a gob of tests). These two tests use #= when
validating the results of performing #copyUpTo: and #copyUpToLast: in an
Interval. In GemStone #= for SequenceableCollection requires that "the
two collections are of the same class". In the case of the test an Array
and an Interval are being compared and even though the interval is
correct, the test fails...

As far as I can tell, the use of #= is a side effect of the test and not
an explicit assertion that #= is expected to work on instances of
different subclasses of SequenceableCollection.

There is only one spot in each test where the problem occurs:

        "no match"
        self isUnique ifFalse: [
                sub := collection copyUpToLast: self excludedElement.
                self
                     assert: sub
                     validSequencedNewResponseFrom: collection.
                self assert: sub size = collection size.
"====>" self assert: sub = collection ].

if the marked line above is changed to:

"====>" self assert: sub = collection asArray ].

The test passes in GemStone ... presumably it will pass elsewhere as well.

If there's no problem with changing the tests then I'll go ahead and
commit my changes (copy the two methods to GRIntervalTest with the
suggested changes).

Otherwise...

Dale
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRIntervalTest #testCopyUpToLast and #testCopyUpTo

Julian Fitzell-2
Would probably be fine, but maybe more explicit to use
#keysAndValuesDo: on one and assert that each element matches with
#at: on the other?

Whatever you think is best; the use of #= is not essential to the test.

Julian

On Thu, Jun 3, 2010 at 11:13 PM, Dale Henrichs <[hidden email]> wrote:

> GRIntervalTest inherits both #testCopyUpToLast and #testCopyUpTo (so the
> tests are shared amongst a gob of tests). These two tests use #= when
> validating the results of performing #copyUpTo: and #copyUpToLast: in an
> Interval. In GemStone #= for SequenceableCollection requires that "the two
> collections are of the same class". In the case of the test an Array and an
> Interval are being compared and even though the interval is correct, the
> test fails...
>
> As far as I can tell, the use of #= is a side effect of the test and not an
> explicit assertion that #= is expected to work on instances of different
> subclasses of SequenceableCollection.
>
> There is only one spot in each test where the problem occurs:
>
>        "no match"
>        self isUnique ifFalse: [
>                sub := collection copyUpToLast: self excludedElement.
>                self
>                    assert: sub
>                    validSequencedNewResponseFrom: collection.
>                self assert: sub size = collection size.
> "====>"         self assert: sub = collection ].
>
> if the marked line above is changed to:
>
> "====>"         self assert: sub = collection asArray ].
>
> The test passes in GemStone ... presumably it will pass elsewhere as well.
>
> If there's no problem with changing the tests then I'll go ahead and commit
> my changes (copy the two methods to GRIntervalTest with the suggested
> changes).
>
> Otherwise...
>
> Dale
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRIntervalTest #testCopyUpToLast and #testCopyUpTo

Dale Henrichs
Using #keysAndValuesDo: is probably the cleanest solution...

Dale

Julian Fitzell wrote:

> Would probably be fine, but maybe more explicit to use
> #keysAndValuesDo: on one and assert that each element matches with
> #at: on the other?
>
> Whatever you think is best; the use of #= is not essential to the test.
>
> Julian
>
> On Thu, Jun 3, 2010 at 11:13 PM, Dale Henrichs <[hidden email]> wrote:
>> GRIntervalTest inherits both #testCopyUpToLast and #testCopyUpTo (so the
>> tests are shared amongst a gob of tests). These two tests use #= when
>> validating the results of performing #copyUpTo: and #copyUpToLast: in an
>> Interval. In GemStone #= for SequenceableCollection requires that "the two
>> collections are of the same class". In the case of the test an Array and an
>> Interval are being compared and even though the interval is correct, the
>> test fails...
>>
>> As far as I can tell, the use of #= is a side effect of the test and not an
>> explicit assertion that #= is expected to work on instances of different
>> subclasses of SequenceableCollection.
>>
>> There is only one spot in each test where the problem occurs:
>>
>>        "no match"
>>        self isUnique ifFalse: [
>>                sub := collection copyUpToLast: self excludedElement.
>>                self
>>                    assert: sub
>>                    validSequencedNewResponseFrom: collection.
>>                self assert: sub size = collection size.
>> "====>"         self assert: sub = collection ].
>>
>> if the marked line above is changed to:
>>
>> "====>"         self assert: sub = collection asArray ].
>>
>> The test passes in GemStone ... presumably it will pass elsewhere as well.
>>
>> If there's no problem with changing the tests then I'll go ahead and commit
>> my changes (copy the two methods to GRIntervalTest with the suggested
>> changes).
>>
>> Otherwise...
>>
>> Dale
>> _______________________________________________
>> seaside-dev mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev

_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev