harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paulex Yang <paulex.y...@gmail.com>
Subject Re: [build] anybody seeing MathTest failure?
Date Wed, 13 Sep 2006 03:10:57 GMT
Nathan Beyer wrote:
> For asserting NaN we should do something like this:
>
> assertTrue(Double.isNaN((code to return NaN));
>   
I agree, it's much clear and concise. But I think the assertEquals() 
should  be more defensive, for example, we may need to write test like this:

assertEquals(some code may return NaN, some_other_code may return NaN, 
delta);

> -Nathan
>
>   
>> -----Original Message-----
>> From: Paulex Yang [mailto:paulex.yang@gmail.com]
>> Sent: Tuesday, September 12, 2006 4:50 AM
>> To: harmony-dev@incubator.apache.org
>> Subject: Re: [build] anybody seeing MathTest failure?
>>
>> Mikhail Loenko wrote:
>>     
>>> it works! thanks, Paulex
>>>       
>> Welcome, thanks a lot for Spark's tips:).
>>
>> However, I consider it as a JUnit's bug, because it's
>> assertEquals(String, double, double, double) method has special handling
>> code for INFINITE but not for NaN[1], but seems it is intended behavior
>> as the comment shows, hmm...
>>
>> [1] snippet from junit.framework.Assert
>>     static public void assertEquals(String message, double expected,
>> double actual, double delta) {
>>         // handle infinity specially since subtracting to infinite
>> values gives NaN and the
>>         // the following test fails
>>         if (Double.isInfinite(expected)) {
>>             if (!(expected == actual))
>>                 failNotEquals(message, new Double(expected), new
>> Double(actual));
>>         } else if (!(Math.abs(expected-actual) <= delta)) // Because
>> comparison with NaN always returns false    (<== Paulex: before this
>> line, seems should check the NaN at first)
>>             failNotEquals(message, new Double(expected), new
>> Double(actual));
>>     }
>>     
>>> 2006/9/12, Paulex Yang <paulex.yang@gmail.com>:
>>>       
>>>> Seems caused by r442438, I have recovered part of the update to make
>>>>         
>> the
>>     
>>>> test pass at revision r442527, please verify.
>>>>
>>>>         
>>>       
>> --
>> Paulex Yang
>> China Software Development Lab
>> IBM
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>   


-- 
Paulex Yang
China Software Development Lab
IBM



---------------------------------------------------------------------
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


Mime
View raw message