-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoint2Test.java
78 lines (70 loc) · 2.3 KB
/
Point2Test.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import student.TestCase;
/**
* @author pacog94 & silverg
* @version 2
*/
public class Point2Test
extends TestCase
{
/**
* This method sets up the tests that follow.
*/
public void setUp()
{
// Nothing here yet
}
// ----------------------------------------------------------
/**
* This method is simply to get code coverage of the class declaration.
*/
public void testRInit()
{
Point2 dum = new Point2();
assertNotNull(dum);
Point2.main(null);
assertFuzzyEquals("Hello, World\n", systemOut().getHistory());
}
// ----------------------------------------------------------
/**
* Test command parser syntax on mostly bad input
*
* @throws Exception
*/
public void testSyntax1()
throws Exception
{
String[] args = new String[1];
args[0] = "P2SyntaxTest1.txt";
Point2.main(args);
assertEquals(
"Point rejected: (r_r, -1, -20)\n"
+ "Point rejected: (rec, 7, -8)\n" + "Duplicate points:\n"
+ "SkipList dump:\n" + "Node has depth 1, Value (null)\n"
+ "SkipList size is: 0\n" + "QuadTree dump:\n"
+ "Node at 0, 0, 1024: Empty\n" + "1 quadtree nodes printed\n"
+ "Point not found: r_r\n" + "Point not removed: r_r\n"
+ "Point rejected: (1, -1)\n" + "Point not found: (1, 1)\n"
+ "Points intersecting region (-5, -5, 20, 20):\n"
+ "1 quadtree nodes visited\n"
+ "Rectangle rejected: (5, 5, 4, -2)\n",
systemOut().getHistory());
}
// ----------------------------------------------------------
/**
* Simple test of all the "good" command outputs
*
* @throws Exception
*/
public void testSyntax2()
throws Exception
{
String[] args = new String[1];
args[0] = "P2SyntaxTest2.txt";
Point2.main(args);
assertTrue(
systemOut().getHistory()
.endsWith("SkipList size is: 2\n" + "QuadTree dump:\n"
+ "Node at 0, 0, 1024:\n" + "far, 200, 200\n"
+ "r_42, 1, 20\n" + "1 quadtree nodes printed\n"));
}
}