1 package junit.tests.framework;
2
3 import junit.framework.AssertionFailedError;
4 import junit.framework.TestCase;
5
6 public class DoublePrecisionAssertTest extends TestCase {
7
8
9
10
11 public void testAssertEqualsNaNFails() {
12 try {
13 assertEquals(1.234, Double.NaN, 0.0);
14 fail();
15 } catch (AssertionFailedError e) {
16 }
17 }
18
19 public void testAssertNaNEqualsFails() {
20 try {
21 assertEquals(Double.NaN, 1.234, 0.0);
22 fail();
23 } catch (AssertionFailedError e) {
24 }
25 }
26
27 public void testAssertNaNEqualsNaN() {
28 assertEquals(Double.NaN, Double.NaN, 0.0);
29 }
30
31 public void testAssertPosInfinityNotEqualsNegInfinity() {
32 try {
33 assertEquals(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.0);
34 fail();
35 } catch (AssertionFailedError e) {
36 }
37 }
38
39 public void testAssertPosInfinityNotEquals() {
40 try {
41 assertEquals(Double.POSITIVE_INFINITY, 1.23, 0.0);
42 fail();
43 } catch (AssertionFailedError e) {
44 }
45 }
46
47 public void testAssertPosInfinityEqualsInfinity() {
48 assertEquals(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, 0.0);
49 }
50
51 public void testAssertNegInfinityEqualsInfinity() {
52 assertEquals(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.0);
53 }
54
55 }