commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ameyjadiye <...@git.apache.org>
Subject [GitHub] commons-numbers pull request #8: Add-some-Unit-Tests
Date Mon, 10 Jul 2017 19:35:28 GMT
Github user ameyjadiye commented on a diff in the pull request:

    https://github.com/apache/commons-numbers/pull/8#discussion_r126515101
  
    --- Diff: commons-numbers-arrays/src/test/java/org/apache/commons/numbers/arrays/SafeNormTest.java
---
    @@ -24,39 +26,52 @@
         @Test
         public void testTiny() {
             final double s = 1e-320;
    -        final double[] v = new double[] { s, s };
    -        Assert.assertEquals(Math.sqrt(2) * s, SafeNorm.value(v), 0d);
    +        final double[] v = new double[]{s, s};
    +        assertEquals(Math.sqrt(2) * s, SafeNorm.value(v), 0d);
         }
     
         @Test
         public void testBig() {
             final double s = 1e300;
    -        final double[] v = new double[] { s, s };
    -        Assert.assertEquals(Math.sqrt(2) * s, SafeNorm.value(v), 0d);
    +        final double[] v = new double[]{s, s};
    +        assertEquals(Math.sqrt(2) * s, SafeNorm.value(v), 0d);
         }
     
         @Test
         public void testOne3D() {
             final double s = 1;
    -        final double[] v = new double[] { s, s, s };
    -        Assert.assertEquals(Math.sqrt(3), SafeNorm.value(v), 0d);
    +        final double[] v = new double[]{s, s, s};
    +        assertEquals(Math.sqrt(3), SafeNorm.value(v), 0d);
         }
     
         @Test
         public void testUnit3D() {
    -        Assert.assertEquals(1, SafeNorm.value(new double[] { 1, 0, 0 }), 0d);
    -        Assert.assertEquals(1, SafeNorm.value(new double[] { 0, 1, 0 }), 0d);
    -        Assert.assertEquals(1, SafeNorm.value(new double[] { 0, 0, 1 }), 0d);
    +        assertEquals(1, SafeNorm.value(new double[]{1, 0, 0}), 0d);
    +        assertEquals(1, SafeNorm.value(new double[]{0, 1, 0}), 0d);
    +        assertEquals(1, SafeNorm.value(new double[]{0, 0, 1}), 0d);
         }
     
         @Test
         public void testSimple() {
    -        final double[] v = new double[] { -0.9, 8.7, -6.5, -4.3, -2.1, 0, 1.2, 3.4, -5.6,
7.8, 9.0 };
    +        final double[] v = new double[]{-0.9, 8.7, -6.5, -4.3, -2.1, 0, 1.2, 3.4, -5.6,
7.8, 9.0};
             double n = 0;
             for (int i = 0; i < v.length; i++) {
                 n += v[i] * v[i];
             }
             final double expected = Math.sqrt(n);
    -        Assert.assertEquals(expected, SafeNorm.value(v), 0d);
    +        assertEquals(expected, SafeNorm.value(v), 0d);
    +    }
    +
    +    @Test
    +    public void testValueReturningPositive() {
    +
    --- End diff --
    
    Say no to empty lines


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message