-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathWeirdTesting.java
More file actions
40 lines (30 loc) · 812 Bytes
/
WeirdTesting.java
File metadata and controls
40 lines (30 loc) · 812 Bytes
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
package itx.examples.javaisweird.tests;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import static org.junit.jupiter.api.Assertions.*;
public class WeirdTesting {
@Test
public void testBigDecimalCompare() {
BigDecimal x = new BigDecimal("1");
BigDecimal y = new BigDecimal("1.00");
assertFalse(x.equals(y));
assertTrue(x.compareTo(y) == 0);
}
@Test
public void testIntegerCompare() {
Integer a = 42;
Integer b = 42;
Integer c = 666;
Integer d = 666;
assertTrue(a == b);
assertEquals(a, b);
assertFalse(c == d);
assertEquals(c, d);
}
@Test
public void testCharArithmetic() {
char ch = '0';
ch *= 1.1;
assertEquals('4', ch);
}
}