This repository has been archived by the owner on Nov 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JUnitTools.java
62 lines (54 loc) · 2.2 KB
/
JUnitTools.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package us.ihmc.x.tools;
import static org.junit.jupiter.api.Assertions.*;
public class JUnitTools
{
public static void assertArrayEqualsDelta(double[] expecteds, double[] actuals, double delta)
{
if (delta == 0.0)
org.junit.jupiter.api.Assertions.assertArrayEquals(expecteds, actuals);
else
org.junit.jupiter.api.Assertions.assertArrayEquals(expecteds, actuals, delta);
}
public static void assertArrayEqualsDelta(float[] expecteds, float[] actuals, float delta)
{
if (delta == 0.0)
org.junit.jupiter.api.Assertions.assertArrayEquals(expecteds, actuals);
else
org.junit.jupiter.api.Assertions.assertArrayEquals(expecteds, actuals, delta);
}
public static void assertArrayEqualsDelta(String string, double[] data, double[] ds, double delta)
{
if (delta == 0.0)
org.junit.jupiter.api.Assertions.assertArrayEquals(data, ds, string);
else
org.junit.jupiter.api.Assertions.assertArrayEquals(data, ds, delta, string);
}
static public void assertEqualsDelta(String message, double expected, double actual, double delta)
{
if (delta == 0.0)
org.junit.jupiter.api.Assertions.assertEquals(expected, actual, message);
else
org.junit.jupiter.api.Assertions.assertEquals(expected, actual, delta, message);
}
static public void assertEqualsDelta(String message, float expected, float actual, float delta)
{
if (delta == 0.0)
org.junit.jupiter.api.Assertions.assertEquals(expected, actual, message);
else
org.junit.jupiter.api.Assertions.assertEquals(expected, actual, delta, message);
}
static public void assertEqualsDelta(double expected, double actual, double delta)
{
if (delta == 0.0)
org.junit.jupiter.api.Assertions.assertEquals(expected, actual);
else
org.junit.jupiter.api.Assertions.assertEquals(expected, actual, delta);
}
static public void assertEqualsDelta(float expected, float actual, float delta)
{
if (delta == 0.0)
org.junit.jupiter.api.Assertions.assertEquals(expected, actual);
else
org.junit.jupiter.api.Assertions.assertEquals(expected, actual, delta);
}
}