Commit f5a2bf97 authored by IDSidorov's avatar IDSidorov
Browse files

Upload New File

parent cedbe637
Pipeline #3872 passed with stage
in 1 minute and 41 seconds
from main import TTarget, TAircraft, TMissle, RLS
import math
def test_taircraft():
#1
aircraft = TAircraft(5, 6, 4, 3)
TTarget.T0 = 0
print(aircraft.Move(9))
assert aircraft.Move(9) == (3434.828608475245, -482.9102114754068)
#2
aircraft = TAircraft(7, 2, 1, 3)
TTarget.T0 = 10
print(aircraft.Move(20))
assert aircraft.Move(20) == (959.7301690209014, -133.8083920765019)
def test_tmissle():
#1
missle = TMissle(7, 3, 1, 5, 2)
TTarget.T0 = 0
print(missle.Move(15))
assert missle.Move(15) == (-12686.822237602779, 42914.656560842806)
#2
missle = TMissle(8, 5, 1, 7, 7)
TTarget.T0 = 10
print(missle.Move(20))
assert missle.Move(20) == (-51504.35504483747, -44885.33788920249)
def test_peleng():
aircraft = TAircraft(300, 200, 100, math.pi / 3)
missle_1 = TMissle(200, -100, 100, math.pi / 4, 50)
missle_2 = TMissle(100, 200, 200, math.pi / 4, 50)
rls = RLS(50, 100, 1000)
rls.Targets.append(aircraft)
rls.Targets.append(missle_1)
rls.Targets.append(missle_2)
rls.Peleng(0, 10, 0.1)
f = open('log.txt')
lines = []
for line in f:
lines.append(line)
f.close()
true_lines = ['0.1; Aircraft #1; D = 769.0010595563058; Az = 1.2047009523303673\n']
assert lines == true_lines
test_taircraft()
test_tmissle()
test_peleng()
\ No newline at end of file
Markdown is supported
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