Java Assert Equal assertEquals(double x, double y)

Here you can find the source of assertEquals(double x, double y)

Description

assert Equals

License

Apache License

Declaration

public static void assertEquals(double x, double y) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static void assertEquals(double x, double y) {
        assertEquals(x, y, 1e-10);/*from   w ww . j a  v  a 2  s.c  o m*/
    }

    public static void assertEquals(double x, double y, double tol) {
        assert approxEquals(x, y, tol) : x + " != " + y;
    }

    public static boolean approxEquals(double x, double y, double tol) {
        return Math.abs(x - y) < tol;
    }

    public static boolean approxEquals(double x, double y) {
        return approxEquals(x, y, 1e-10);
    }
}

Related

  1. assertDatesEqual(Calendar first, Calendar second)
  2. assertEqual(final double d1, final double d2, final double precisionRange)
  3. assertEqual(Object obj1, Object obj2)
  4. assertEquality(Object original, Object equal, Object... notEqual)
  5. assertEquals(double x, double y)
  6. assertEquals(final int expected, final int actual)
  7. assertEquals(final Object actual, final Object expected, final String name)
  8. assertEquals(float a1, float a2)
  9. assertEquals(int a, int b)