Beispiel #1
0
 public static void assertEquals(
     final String message,
     final Quaternion expected,
     final Quaternion actual,
     final NumberContext context) {
   TestUtils.assertEquals(message, (Number) expected, (Number) actual, context);
   TestUtils.assertEquals(message, (Access1D<?>) expected, (Access1D<?>) actual, context);
 }
Beispiel #2
0
 public static void assertBounds(
     final Number lower,
     final Access1D<?> values,
     final Number upper,
     final NumberContext precision) {
   for (final Number tmpValue : values) {
     TestUtils.assertBounds(lower, tmpValue, upper, precision);
   }
 }
Beispiel #3
0
 public static void assertEquals(
     final String message,
     final Access1D<?> expected,
     final Access1D<?> actual,
     final NumberContext context) {
   for (long i = 0; i < expected.count(); i++) {
     TestUtils.assertEquals(message + " @ " + i, expected.get(i), actual.get(i), context);
   }
 }
Beispiel #4
0
 public void testACOSH() {
   TestUtils.assertEquals(ZERO, ACOSH.invoke(ONE), MACHINE_EPSILON);
 }
Beispiel #5
0
 public static void assertEquals(final ComplexNumber expected, final ComplexNumber actual) {
   TestUtils.assertEquals(expected, actual, EQUALS);
 }
Beispiel #6
0
 public static void assertEquals(
     final Access1D<?> expected, final Access1D<?> actual, final NumberContext context) {
   TestUtils.assertEquals("Access1D<?> != Access1D<?>", expected, actual, context);
 }
Beispiel #7
0
 public static void assertEquals(final Access1D<?> expected, final Access1D<?> actual) {
   TestUtils.assertEquals(expected, actual, EQUALS);
 }
Beispiel #8
0
 public static void assertEquals(final double expected, final double actual) {
   TestUtils.assertEquals(expected, actual, EQUALS);
 }
Beispiel #9
0
  public void testPOWER() {

    TestUtils.assertEquals(ONE, POWER.invoke(ZERO, 0), MACHINE_EPSILON);
    TestUtils.assertEquals(ONE, POWER.invoke(PI, 0), MACHINE_EPSILON);
    TestUtils.assertEquals(ONE, POWER.invoke(E, 0), MACHINE_EPSILON);

    TestUtils.assertEquals(ZERO, POWER.invoke(ZERO, 1), MACHINE_EPSILON);
    TestUtils.assertEquals(PI, POWER.invoke(PI, 1), MACHINE_EPSILON);
    TestUtils.assertEquals(E, POWER.invoke(E, 1), MACHINE_EPSILON);

    TestUtils.assertEquals(ZERO * ZERO, POWER.invoke(ZERO, 2), MACHINE_EPSILON);
    TestUtils.assertEquals(PI * PI, POWER.invoke(PI, 2), MACHINE_EPSILON);
    TestUtils.assertEquals(E * E, POWER.invoke(E, 2), MACHINE_EPSILON);

    TestUtils.assertEquals(1 / ZERO, POWER.invoke(ZERO, -1), MACHINE_EPSILON);
    TestUtils.assertEquals(1 / PI, POWER.invoke(PI, -1), MACHINE_EPSILON);
    TestUtils.assertEquals(1 / E, POWER.invoke(E, -1), MACHINE_EPSILON);
  }
Beispiel #10
0
 public static void assertEquals(
     final String message, final Number expected, final Number actual) {
   TestUtils.assertEquals(message, expected, actual, EQUALS);
 }
Beispiel #11
0
 public static void assertEquals(
     final String message, final long[] expected, final long[] actual) {
   TestUtils.assertTrue(message, Arrays.equals(expected, actual));
 }
Beispiel #12
0
 public static void assertEquals(
     final Quaternion expected, final Quaternion actual, final NumberContext context) {
   TestUtils.assertEquals("Quaternion != Quaternion", expected, actual, context);
 }
Beispiel #13
0
 public static void assertEquals(
     final Number expected, final Number actual, final NumberContext context) {
   TestUtils.assertEquals("Number != Number", expected, actual, context);
 }
Beispiel #14
0
 public static void assertEquals(final long[] expected, final long[] actual) {
   TestUtils.assertEquals(
       Arrays.toString(expected) + " != " + Arrays.toString(actual), expected, actual);
 }
Beispiel #15
0
 public static void assertEquals(
     final double expected, final double actual, final NumberContext context) {
   TestUtils.assertEquals("double != double", expected, actual, context);
 }
Beispiel #16
0
 public void testASINH() {
   TestUtils.assertEquals(ZERO, ASINH.invoke(ZERO), MACHINE_EPSILON);
 }
Beispiel #17
0
 public void testATANH() {
   TestUtils.assertEquals(ZERO, ATANH.invoke(ZERO), MACHINE_EPSILON);
   TestUtils.assertEquals(POSITIVE_INFINITY, ATANH.invoke(ONE), MACHINE_EPSILON);
   TestUtils.assertEquals(NEGATIVE_INFINITY, ATANH.invoke(NEG), MACHINE_EPSILON);
 }
Beispiel #18
0
 public static void assertEquals(
     final String message, final Quaternion expected, final Quaternion actual) {
   TestUtils.assertEquals(message, expected, actual, EQUALS);
 }
Beispiel #19
0
  public void testMinMax() {

    TestUtils.assertEquals(Math.min(2, -78), FunctionUtils.min(2, -78));
    TestUtils.assertEquals(Math.max(2, -78), FunctionUtils.max(2, -78));

    TestUtils.assertEquals(67, FunctionUtils.max(new int[] {67}));
    TestUtils.assertEquals(67, FunctionUtils.min(new int[] {67}));

    TestUtils.assertEquals(FunctionUtils.max(67, -76), FunctionUtils.max(new int[] {67, -76}));
    TestUtils.assertEquals(FunctionUtils.min(67, -76), FunctionUtils.min(new int[] {67, -76}));

    TestUtils.assertEquals(
        FunctionUtils.max(0, 67, -76), FunctionUtils.max(new int[] {0, 67, -76}));
    TestUtils.assertEquals(
        FunctionUtils.min(0, 67, -76), FunctionUtils.min(new int[] {0, 67, -76}));

    TestUtils.assertEquals(
        FunctionUtils.max(0, 67, -76, 80), FunctionUtils.max(new int[] {0, 67, -76, 80}));
    TestUtils.assertEquals(
        FunctionUtils.min(0, 67, -76, -80), FunctionUtils.min(new int[] {0, 67, -76, -80}));

    TestUtils.assertEquals(
        FunctionUtils.max(80, 0, 67, -76), FunctionUtils.max(new int[] {80, 0, 67, -76}));
    TestUtils.assertEquals(
        FunctionUtils.min(-80, 0, 67, -76), FunctionUtils.min(new int[] {-80, 0, 67, -76}));

    TestUtils.assertEquals(80, FunctionUtils.max(new int[] {0, 67, -76, 80}));
    TestUtils.assertEquals(-80, FunctionUtils.min(new int[] {0, 67, -76, -80}));

    TestUtils.assertEquals(80, FunctionUtils.max(new int[] {80, 0, 67, -76}));
    TestUtils.assertEquals(-80, FunctionUtils.min(new int[] {-80, 0, 67, -76}));
  }
Beispiel #20
0
 public static void assertEquals(
     final double expected, final ComplexNumber actual, final NumberContext context) {
   TestUtils.assertEquals("ComplexNumber.re", expected, actual.doubleValue(), context);
   TestUtils.assertEquals("ComplexNumber.im", PrimitiveMath.ZERO, actual.i, context);
 }