You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Mikhail Loenko <ml...@gmail.com> on 2006/06/06 08:05:00 UTC

[classlib] [testing] math2 tests

I've found an issue similar to rmi tests[1]

There is a method BigDecimal.subtract(BigDecimal,MathContext), its
implementation in math2 consists of 30 lines

Implementation does not perform any heavy math: I've counted 5
possible execution paths, different branches are calling
BigInteger.multiply,
BigInteger.subtract, new BigDecimal, and couple more methods.

The test against that method has 2198 generated test cases looking like the
following:

public void testSubtractMathContextXXXX() {
    bigDec= new BigDecimal("...");
    BigDecimal bigDec2= new BigDecimal("...");
    assertEquals(msgNotSame, new BigDecimal("..."),
            bigDec.subtract(bigDec2,new MathContext(...)));
}

Do we need that many tests for this method?

Thanks,
Mikhail

[1] http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200605.mbox/%3c906dd82e0605290601j5f8d43b7x59d1344cb819127f@mail.gmail.com%3e

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib] [testing] math2 tests

Posted by Tim Ellison <t....@gmail.com>.
Stepan Mishura wrote:
> So you suggest to generate thousands of 'dynamic' tests. Right?

Nope, not if there is no new code paths being exercised by them.  I was
just pointing out that even where the thousands of tests do test
different code paths you may choose to generate them dynamically rather
than statically.

Regards,
Tim


> On 6/7/06, Tim Ellison <t....@gmail.com> wrote:
>>
>> I doubt it.
>>
>> Even if it were, the logic used to generate the tests can often be built
>> into the runtime tests themselves to exercise the APIs thoroughly
>> without creating thousands of 'static' tests.
>>
>> Regards,
>> Tim
>>
>>
>> Mikhail Loenko wrote:
>> > I've found an issue similar to rmi tests[1]
>> >
>> > There is a method BigDecimal.subtract(BigDecimal,MathContext), its
>> > implementation in math2 consists of 30 lines
>> >
>> > Implementation does not perform any heavy math: I've counted 5
>> > possible execution paths, different branches are calling
>> > BigInteger.multiply,
>> > BigInteger.subtract, new BigDecimal, and couple more methods.
>> >
>> > The test against that method has 2198 generated test cases looking like
>> the
>> > following:
>> >
>> > public void testSubtractMathContextXXXX() {
>> >    bigDec= new BigDecimal("...");
>> >    BigDecimal bigDec2= new BigDecimal("...");
>> >    assertEquals(msgNotSame, new BigDecimal("..."),
>> >            bigDec.subtract(bigDec2,new MathContext(...)));
>> > }
>> >
>> > Do we need that many tests for this method?
>> >
>> > Thanks,
>> > Mikhail
>> >
>> > [1]
>> >
>> http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200605.mbox/%3c906dd82e0605290601j5f8d43b7x59d1344cb819127f@mail.gmail.com%3e
>>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > Terms of use : http://incubator.apache.org/harmony/mailing.html
>> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
>> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>> >
>> >
>>
>> -- 
>>
>> Tim Ellison (t.p.ellison@gmail.com)
>> IBM Java technology centre, UK.
>>
>> ---------------------------------------------------------------------
>> Terms of use : http://incubator.apache.org/harmony/mailing.html
>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>>
>>
> 
> 
> ------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib] [testing] math2 tests

Posted by Stepan Mishura <st...@gmail.com>.
So you suggest to generate thousands of 'dynamic' tests. Right?

Thanks,
Stepan.


On 6/7/06, Tim Ellison <t....@gmail.com> wrote:
>
> I doubt it.
>
> Even if it were, the logic used to generate the tests can often be built
> into the runtime tests themselves to exercise the APIs thoroughly
> without creating thousands of 'static' tests.
>
> Regards,
> Tim
>
>
> Mikhail Loenko wrote:
> > I've found an issue similar to rmi tests[1]
> >
> > There is a method BigDecimal.subtract(BigDecimal,MathContext), its
> > implementation in math2 consists of 30 lines
> >
> > Implementation does not perform any heavy math: I've counted 5
> > possible execution paths, different branches are calling
> > BigInteger.multiply,
> > BigInteger.subtract, new BigDecimal, and couple more methods.
> >
> > The test against that method has 2198 generated test cases looking like
> the
> > following:
> >
> > public void testSubtractMathContextXXXX() {
> >    bigDec= new BigDecimal("...");
> >    BigDecimal bigDec2= new BigDecimal("...");
> >    assertEquals(msgNotSame, new BigDecimal("..."),
> >            bigDec.subtract(bigDec2,new MathContext(...)));
> > }
> >
> > Do we need that many tests for this method?
> >
> > Thanks,
> > Mikhail
> >
> > [1]
> >
> http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200605.mbox/%3c906dd82e0605290601j5f8d43b7x59d1344cb819127f@mail.gmail.com%3e
> >
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
> --
>
> Tim Ellison (t.p.ellison@gmail.com)
> IBM Java technology centre, UK.
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

Re: [classlib] [testing] math2 tests

Posted by Tim Ellison <t....@gmail.com>.
I doubt it.

Even if it were, the logic used to generate the tests can often be built
into the runtime tests themselves to exercise the APIs thoroughly
without creating thousands of 'static' tests.

Regards,
Tim


Mikhail Loenko wrote:
> I've found an issue similar to rmi tests[1]
> 
> There is a method BigDecimal.subtract(BigDecimal,MathContext), its
> implementation in math2 consists of 30 lines
> 
> Implementation does not perform any heavy math: I've counted 5
> possible execution paths, different branches are calling
> BigInteger.multiply,
> BigInteger.subtract, new BigDecimal, and couple more methods.
> 
> The test against that method has 2198 generated test cases looking like the
> following:
> 
> public void testSubtractMathContextXXXX() {
>    bigDec= new BigDecimal("...");
>    BigDecimal bigDec2= new BigDecimal("...");
>    assertEquals(msgNotSame, new BigDecimal("..."),
>            bigDec.subtract(bigDec2,new MathContext(...)));
> }
> 
> Do we need that many tests for this method?
> 
> Thanks,
> Mikhail
> 
> [1]
> http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200605.mbox/%3c906dd82e0605290601j5f8d43b7x59d1344cb819127f@mail.gmail.com%3e
> 
> 
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> 
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org