Пример #1
0
 def test_PositiveGetGateDistance(self):
     line = self.correctSysLine
     testSys = System()
     testSys.build(line[0], line[1], line[2], line[3], line[4], line[5], line[6], line[7])
     line = self.correctGateData
     testSys.addGatePos(line[0][5], [line[0][1], line[0][2], line[0][3]])
     testSys.addGatePos(line[1][5], [line[1][1], line[1][2], line[1][3]])
     expectedResult = round((convert(self.distances[1], 1)/1000)/149597871, 1)
     actualResult = int(testSys.getGateDistance(line[0][5], line[1][5]))
     self.assertEqual(expectedResult, actualResult, "Fail: Gate distances not calculated correctly")
Пример #2
0
 def test_PositiveaddgetGatePos(self):
     self.main.loadSystems()
     line = self.correctSysLine
     testSys = System()
     testSys.build(line[0], line[1], line[2], line[3], line[4], line[5], line[6], line[7])
     line = self.correctGateData[0]
     testSys.addGatePos(line[5], [line[1], line[2], line[3]])
     pos = testSys.getGatePos(line[5])
     self.assertEqual(convert(line[1], 2), pos[0], "Fail: PosX not added correctly")
     self.assertEqual(convert(line[2], 2), pos[1], "Fail: PosY not added correctly")
     self.assertEqual(convert(line[3], 2), pos[2], "Fail: PosZ not added correctly")
Пример #3
0
 def test_NegativeaddgetGatePos(self):
     line = self.correctSysLine
     testSys = System()
     testSys.build(line[0], line[1], line[2], line[3], line[4], line[5], line[6], line[7])
     line = self.corruptMissingGateData
     with self.assertRaises(IndexError):
         testSys.addGatePos(line[4], [line[1], line[2]])
     line = self.corruptWrongGateData
     with self.assertRaises(ValueError):
         testSys.addGatePos(line[5], [line[1], line[2], line[3]])
     with self.assertRaises(KeyError):
         testSys.getGatePos("fail")
Пример #4
0
 def test_NegativeGetGateDistance(self):
     line = self.correctSysLine
     testSys = System()
     testSys.build(line[0], line[1], line[2], line[3], line[4], line[5], line[6], line[7])
     line = self.correctGateData
     testSys.addGatePos(line[0][5], [line[0][1], line[0][2], line[0][3]])
     testSys.addGatePos(line[1][5], [line[1][1], line[1][2], line[1][3]])
     with self.assertRaises(KeyError):
         testSys.getGateDistance(line[0][5], "Test")
     with self.assertRaises(KeyError):
         testSys.getGateDistance("Test", line[1][5])
     with self.assertRaises(GeneralError):
         testSys.getGateDistance(line[1][5], line[1][5])
Пример #5
0
 def test_PositiveGetGateDistance(self):
     line = self.correctSysLine
     testSys = System()
     testSys.build(line[0], line[1], line[2], line[3], line[4], line[5],
                   line[6], line[7])
     line = self.correctGateData
     testSys.addGatePos(line[0][5], [line[0][1], line[0][2], line[0][3]])
     testSys.addGatePos(line[1][5], [line[1][1], line[1][2], line[1][3]])
     expectedResult = round(
         (convert(self.distances[1], 1) / 1000) / 149597871, 1)
     actualResult = int(testSys.getGateDistance(line[0][5], line[1][5]))
     self.assertEqual(expectedResult, actualResult,
                      "Fail: Gate distances not calculated correctly")
Пример #6
0
 def test_NegativeaddgetGatePos(self):
     line = self.correctSysLine
     testSys = System()
     testSys.build(line[0], line[1], line[2], line[3], line[4], line[5],
                   line[6], line[7])
     line = self.corruptMissingGateData
     with self.assertRaises(IndexError):
         testSys.addGatePos(line[4], [line[1], line[2]])
     line = self.corruptWrongGateData
     with self.assertRaises(ValueError):
         testSys.addGatePos(line[5], [line[1], line[2], line[3]])
     with self.assertRaises(KeyError):
         testSys.getGatePos("fail")
Пример #7
0
 def test_NegativeGetGateDistance(self):
     line = self.correctSysLine
     testSys = System()
     testSys.build(line[0], line[1], line[2], line[3], line[4], line[5],
                   line[6], line[7])
     line = self.correctGateData
     testSys.addGatePos(line[0][5], [line[0][1], line[0][2], line[0][3]])
     testSys.addGatePos(line[1][5], [line[1][1], line[1][2], line[1][3]])
     with self.assertRaises(KeyError):
         testSys.getGateDistance(line[0][5], "Test")
     with self.assertRaises(KeyError):
         testSys.getGateDistance("Test", line[1][5])
     with self.assertRaises(GeneralError):
         testSys.getGateDistance(line[1][5], line[1][5])
Пример #8
0
 def test_PositiveaddgetGatePos(self):
     self.main.loadSystems()
     line = self.correctSysLine
     testSys = System()
     testSys.build(line[0], line[1], line[2], line[3], line[4], line[5],
                   line[6], line[7])
     line = self.correctGateData[0]
     testSys.addGatePos(line[5], [line[1], line[2], line[3]])
     pos = testSys.getGatePos(line[5])
     self.assertEqual(convert(line[1], 2), pos[0],
                      "Fail: PosX not added correctly")
     self.assertEqual(convert(line[2], 2), pos[1],
                      "Fail: PosY not added correctly")
     self.assertEqual(convert(line[3], 2), pos[2],
                      "Fail: PosZ not added correctly")