Commit 9390a17d authored by SETaratukhina's avatar SETaratukhina
Browse files

Update test.py

parent f237fd46
Pipeline #3922 failed with stage
in 4 seconds
import unittest
import math
from main import TTarget, TAircraft, TMissle, RLS
class test(unittest.TestCase):
from main import TAircraft, TMissle, RLS
class testRLS(unittest.TestCase):
def test_Aircraft(self):
......@@ -13,7 +11,7 @@ class test(unittest.TestCase):
aircraft.Move(10)
self.assertEqual(round(aircraft.x, 2), -12492.44)
self.assertEqual(round(aircraft .y, 2), -7187.71)
def test_Missle(self):
missle = TMissle(5, 10, 20, math.pi/6, 15)
missle.T0 = 0
......@@ -21,8 +19,10 @@ class test(unittest.TestCase):
self.assertEqual(round(missle.x, 2), -174.19)
self.assertEqual(round(missle.y, 2), -93.45)
def testRlsPeleng(self):
air1 = TAircraft(20, 10, 25, math.pi / 3)
air1 = TAircraft(20, 10, 25, math.pi / 3)
air2 = TAircraft(2000, 2000, 200, math.pi / 6)
mis1 = TMissle(100, 50, 50, math.pi / 4, 30)
......@@ -40,15 +40,14 @@ class test(unittest.TestCase):
for line in f:
lines.append(line)
f.close()
true_lines = ['0.1; Aircraft #1; D = 334.0743692766258; Az = 0.9795746556124477\n',
true_lines = ['0.1; Aircraft #1; D = 334.0743692766258; Az = 0.9795746556124477\n',
'0.1; Missle #1; D = 514.929470155641; Az = 0.8501314037713014\n',
'0.2; Aircraft #1; D = 574.4377296150348; Az = 1.006690412224313\n',
'0.3; Aircraft #1; D = 814.9350053796323; Az = 1.01828854721129\n']
self.assertEqual(lines, true_lines)
print('All tests passed correctly!')
if __name__ == '__main__':
unittest.main()
......@@ -57,3 +56,4 @@ if __name__ == '__main__':
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment