org.eclipse.january.asserts

## Class TestUtils

- java.lang.Object
- - org.eclipse.january.asserts.TestUtils

-     public class TestUtils
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TestUtils.VerboseSuite` Suite that adds a Run listener that prints when methods start and finish
    `static class` | `TestUtils.Verbosity`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TestUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `assertDatasetEquals(Dataset expected, Dataset actual)` Assert equality of datasets where each item is true if they are equal or for floating point datasets, if `abs(a - b) ≤ 1e-12 + 1e-12*abs(b)`
    `static void` | `assertDatasetEquals(Dataset expected, Dataset actual, boolean testDTypeAndItemSize)` Assert equality of datasets where each element is true if they are equal or for floating point datasets, if `abs(a - b) ≤ 1e-12 + 1e-12*abs(b)`
    `static void` | `assertDatasetEquals(Dataset expected, Dataset actual, boolean testDTypeAndItemSize, double relTolerance, double absTolerance)` Assert equality of datasets where each element is true if they are equal or for floating point datasets, if `abs(a - b) ≤ absTolerance + relTolerance*abs(b)`.
    `static void` | `assertDatasetEquals(Dataset expected, Dataset actual, double relTolerance, double absTolerance)` Assert equality of datasets where each element is true if they are equal or for floating point datasets, if `abs(a - b) ≤ absTolerance + relTolerance*abs(b)`.
    `static void` | `assertEquals(String s, double e, double a)` Assert equality if `abs(e - a) ≤ max(1e-20, 1e-14*max(abs(e), abs(a)))`
    `static void` | `assertEquals(String s, double e, double a, double relTol, double absTol)` Assert equality if `abs(e - a) ≤ max(absTol, relTol*max(abs(e), abs(a)))`
    `static void` | `setVerbosity(TestUtils.Verbosity verbosity)`
    `static void` | `verbosePrintf(String fmt, Object... args)` Print when verbosity set to verbose
    `static void` | `verbosePrintln(String arg)` Print when verbosity set to verbose

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TestUtils

          public TestUtils()

  - ### Method Detail

    - #### assertDatasetEquals

          public static void assertDatasetEquals(Dataset expected,
                                                 Dataset actual)

      Assert equality of datasets where each item is true if they are equal or for floating point datasets, if `abs(a - b) ≤ 1e-12 + 1e-12*abs(b)`

      The dataset types have to match and so does the number of elements in each item.

      Same as

          TestUtils.assertDatasetEquals(expected, actual, true, 1e-12, 1e-12)

      Parameters:
        `expected` - dataset
        `actual` - dataset

    - #### assertDatasetEquals

          public static void assertDatasetEquals(Dataset expected,
                                                 Dataset actual,
                                                 boolean testDTypeAndItemSize)

      Assert equality of datasets where each element is true if they are equal or for floating point datasets, if `abs(a - b) ≤ 1e-12 + 1e-12*abs(b)`
      Parameters:
        `expected` - dataset
        `actual` - dataset
        `testDTypeAndItemSize` - if true, check dataset type and number of elements

    - #### assertDatasetEquals

          public static void assertDatasetEquals(Dataset expected,
                                                 Dataset actual,
                                                 double relTolerance,
                                                 double absTolerance)

      Assert equality of datasets where each element is true if they are equal or for floating point datasets, if `abs(a - b) ≤ absTolerance + relTolerance*abs(b)`.

      The dataset types does not have to match nor does the number of elements in each item.

      Parameters:
        `expected` - dataset
        `actual` - dataset
        `relTolerance` - relative tolerance
        `absTolerance` - absolute tolerance

    - #### assertDatasetEquals

          public static void assertDatasetEquals(Dataset expected,
                                                 Dataset actual,
                                                 boolean testDTypeAndItemSize,
                                                 double relTolerance,
                                                 double absTolerance)

      Assert equality of datasets where each element is true if they are equal or for floating point datasets, if `abs(a - b) ≤ absTolerance + relTolerance*abs(b)`.
      Parameters:
        `expected` - dataset
        `actual` - dataset
        `testDTypeAndItemSize` - if true, check dataset type and number of elements
        `relTolerance` - relative tolerance
        `absTolerance` - absolute tolerance

    - #### assertEquals

          public static void assertEquals(String s,
                                          double e,
                                          double a)

      Assert equality if `abs(e - a) ≤ max(1e-20, 1e-14*max(abs(e), abs(a)))`
      Parameters:
        `s` - message for assert exception
        `e` - expected value
        `a` - actual value

    - #### assertEquals

          public static void assertEquals(String s,
                                          double e,
                                          double a,
                                          double relTol,
                                          double absTol)

      Assert equality if `abs(e - a) ≤ max(absTol, relTol*max(abs(e), abs(a)))`
      Parameters:
        `s` - message for assert exception
        `e` - expected value
        `a` - actual value
        `relTol` - relative tolerance
        `absTol` - absolute tolerance

    - #### setVerbosity

          public static void setVerbosity(TestUtils.Verbosity verbosity)

      Parameters:
        `verbosity` - level

    - #### verbosePrintf

          public static void verbosePrintf(String fmt,
                                           Object... args)

      Print when verbosity set to verbose
      Parameters:
        `fmt` - format
        `args` - arguments

    - #### verbosePrintln

          public static void verbosePrintln(String arg)

      Print when verbosity set to verbose
      Parameters:
        `arg` - argument

Copyright © 2014–2022 Eclipse Foundation. All rights reserved.