コード例 #1
0
ファイル: tests.py プロジェクト: mat-green/stealth-co
 def testBlank(self):
     # test set up
     component = Graph(20, 10)
     # test execution
     actual = component.render()
     # test verification
     self.assertEqual(actual, "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    ")
コード例 #2
0
ファイル: tests.py プロジェクト: mat-green/stealth-co
 def testBlank(self):
     # test set up
     component = Graph(20,10)
     # test execution
     actual = component.render()
     # test verification
     self.assertEqual(actual, "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    ")
コード例 #3
0
ファイル: tests.py プロジェクト: mat-green/stealth-co
 def testDiagonal(self):
     # test set up
     component = Graph(20, 10)
     start = Coordinate(1, 1)
     end = Coordinate(8, 8)
     # test execution
     component.plot(start, end)
     actual = component.render()
     # test verification
     self.assertEqual(actual, "                    \n" \
                              " X                  \n" \
                              "  X                 \n" \
                              "   X                \n" \
                              "    X               \n" \
                              "     X              \n" \
                              "      X             \n" \
                              "       X            \n" \
                              "        X           \n" \
                              "                    ")
コード例 #4
0
ファイル: tests.py プロジェクト: mat-green/stealth-co
 def testHorizontal(self):
     # test set up
     component = Graph(20, 10)
     start = Coordinate(0, 4)
     end = Coordinate(19, 4)
     # test execution
     component.plot(start, end)
     actual = component.render()
     # test verification
     self.assertEqual(actual, "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "XXXXXXXXXXXXXXXXXXXX\n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    ")
コード例 #5
0
ファイル: tests.py プロジェクト: mat-green/stealth-co
 def testVertical(self):
     # test set up
     component = Graph(20,10)
     start = Coordinate(1,1)
     end = Coordinate(1, 8)
     # test execution
     component.plot(start, end)
     actual = component.render()
     # test verification
     self.assertEqual(actual, "                    \n" \
                              " X                  \n" \
                              " X                  \n" \
                              " X                  \n" \
                              " X                  \n" \
                              " X                  \n" \
                              " X                  \n" \
                              " X                  \n" \
                              " X                  \n" \
                              "                    ")
コード例 #6
0
ファイル: tests.py プロジェクト: mat-green/stealth-co
 def testHorizontal(self):
     # test set up
     component = Graph(20,10)
     start = Coordinate(0,4)
     end = Coordinate(19,4)
     # test execution
     component.plot(start, end)
     actual = component.render()
     # test verification
     self.assertEqual(actual, "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "XXXXXXXXXXXXXXXXXXXX\n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    \n" \
                              "                    ")
コード例 #7
0
ファイル: tests.py プロジェクト: mat-green/stealth-co
 def testBackDiagonal(self):
     # test set up
     component = Graph(20,10)
     start = Coordinate(4,9)
     end = Coordinate(14, 0)
     # test execution
     component.plot(start, end)
     actual = component.render()
     # test verification
     self.assertEqual(actual, "             X      \n" \
                              "            X       \n" \
                              "           X        \n" \
                              "          X         \n" \
                              "         X          \n" \
                              "        X           \n" \
                              "       X            \n" \
                              "      X             \n" \
                              "     X              \n" \
                              "    X               ")
コード例 #8
0
ファイル: main.py プロジェクト: mat-green/stealth-co
def main(argv=None): # IGNORE:C0111
    """Command line interface application
%s
""" % program_usage

    if argv is None:
        argv = sys.argv
    else:
        sys.argv.extend(argv)

    graph = Graph(20,10)
    if(len(sys.argv) > 1):
        pattern = re.compile("\(([0-9]+),([0-9]+)\) - \(([0-9]+),([0-9]+)\)")
        vectors = sys.argv[1].split(', ')
        for coordinates in vectors:
            result = pattern.match(coordinates)
            if result:
                start = Coordinate(int(result.group(1)), int(result.group(2)))
                end = Coordinate(int(result.group(3)), int(result.group(4)))
                graph.plot(start, end)

    print(graph.render())
コード例 #9
0
ファイル: main.py プロジェクト: mat-green/stealth-co
def main(argv=None):  # IGNORE:C0111
    """Command line interface application
%s
""" % program_usage

    if argv is None:
        argv = sys.argv
    else:
        sys.argv.extend(argv)

    graph = Graph(20, 10)
    if (len(sys.argv) > 1):
        pattern = re.compile("\(([0-9]+),([0-9]+)\) - \(([0-9]+),([0-9]+)\)")
        vectors = sys.argv[1].split(', ')
        for coordinates in vectors:
            result = pattern.match(coordinates)
            if result:
                start = Coordinate(int(result.group(1)), int(result.group(2)))
                end = Coordinate(int(result.group(3)), int(result.group(4)))
                graph.plot(start, end)

    print(graph.render())