summaryrefslogtreecommitdiff
path: root/src/Q9/RobotTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Q9/RobotTest.java')
-rw-r--r--src/Q9/RobotTest.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/Q9/RobotTest.java b/src/Q9/RobotTest.java
new file mode 100644
index 0000000..9290993
--- /dev/null
+++ b/src/Q9/RobotTest.java
@@ -0,0 +1,45 @@
+package ca.mokhan.test;
+
+import Q9.*;
+import java.io.*;
+import java.text.*;
+import java.util.*;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class RobotTest extends TestCase {
+ private Robot subject;
+
+ public RobotTest(String testName) {
+ super(testName);
+ this.subject = new Robot(0, 0);
+ }
+
+ public static Test suite() {
+ return new TestSuite(RobotTest.class);
+ }
+
+ public void test_printGrid() {
+ Robot r1 = new Robot(0, 0);
+ Robot r2 = new Robot(9, 9);
+
+ String expected =
+ "|1| | | | | | | | | |\n"
+ + "| | | | | | | | | | |\n"
+ + "| | | | | | | | | | |\n"
+ + "| | | | | | | | | | |\n"
+ + "| | | | | | | | | | |\n"
+ + "| | | | | | | | | | |\n"
+ + "| | | | | | | | | | |\n"
+ + "| | | | | | | | | | |\n"
+ + "| | | | | | | | | | |\n"
+ + "| | | | | | | | | |2|\n";
+ String result = Robot.printGrid(r1, r2);
+
+ System.out.println(expected);
+ System.out.println(result);
+
+ assertEquals(expected, result);
+ }
+}