[ 
https://issues.apache.org/jira/browse/HDFS-3717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13421738#comment-13421738
 ] 

Kihwal Lee commented on HDFS-3717:
----------------------------------

I don't think the use of {{Double.POSITIVE_INFINITY}} is correct. The condition 
{{(a < Double.POSITIVE_INFINITY)}} is always true for any real double number a. 
 Similarly, {{(a < Double.NEGATIVE_INFINITY)}} will be false.  By looking at 
junit4's source, using {{Double.NEGATIVE_INFINITY}} as {{delta}} will work. 
Probably you actually meant this. But the junit documentation says nothing 
about it, so I would prefer using 0.0.

{code:title=From Assert.java, junit 4.3}
static public void  [More ...] assertEquals(String message, double expected, 
double actual, double delta) {
  if (Double.compare(expected, actual) == 0)
    return;
  if (!(Math.abs(expected - actual) <= delta))
    failNotEquals(message, new Double(expected), new Double(actual));
}
{code}
                
> Test cases in TestPBHelper fail
> -------------------------------
>
>                 Key: HDFS-3717
>                 URL: https://issues.apache.org/jira/browse/HDFS-3717
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 2.0.1-alpha
>            Reporter: Kihwal Lee
>            Assignee: Kihwal Lee
>             Fix For: 3.0.0, 2.2.0-alpha
>
>         Attachments: hdfs-3717.patch.txt
>
>
> {{org.apache.hadoop.hdfs.protocolPB.TestPBHelper.testConvertBlockCommand}}
> {{org.apache.hadoop.hdfs.protocolPB.TestPBHelper.testConvertLocatedBlock}}
> {{org.apache.hadoop.hdfs.protocolPB.TestPBHelper.testConvertRecoveringBlock}}
> They all fail with:
> {noformat}
> java.lang.AssertionError: Use assertEquals(expected, actual, delta) 
>  to compare floating-point numbers
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to