forked from csci121s15/Testing-Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRangeTest.java
More file actions
42 lines (36 loc) · 805 Bytes
/
RangeTest.java
File metadata and controls
42 lines (36 loc) · 805 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
41
42
import junit.framework.TestCase;
public class RangeTest extends TestCase
{
public void testNewRange()
{
Range r = new Range(2.0,0.0);
}
public void testContains()
{
Range r = new Range(2.0,0.0);
assertEquals(true, r.contains(1.5));
}
public void testWidth()
{
Range r = new Range(2.0,0.0);
assertEquals(2.0, r.getWidth());
}
public void testMin()
{
Range r = new Range(2.0,0.0);
assertEquals(0.0, r.getMin());
}
public void testMax()
{
Range r = new Range(2.0,0.0);
assertEquals(2.0, r.getMax());
}
public void testIntersection()
{
Range r1 = new Range(0.0,5.0);
Range r2 = new Range(1.0,4.0);
Range r3 = r1.intersection(r2);
assertEquals(1.0, r3.getMin());
assertEquals(4.0, r3.getMax());
}
}