-
Notifications
You must be signed in to change notification settings - Fork 0
/
unit_test_sr.py
executable file
·73 lines (54 loc) · 1.88 KB
/
unit_test_sr.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"""
unit testing UGV drop projectile
author : sydney rabara
assume:
maxY = 30.48
No negative components for points class
The target is origin
"""
import unittest
from ProjectileDrop import *
class TestMethods(inittest,TestCase):
#test the points
def testPointMethods(self):
x = 60.2221;
y = 80.0778;
z = 54.28;
testPoint = point(x,y,z);
self.assertEqual(testPoint.getX(),x)
self.assertEqual(testPoint.getY(),Y)
self.assertEqual(testPoint.getZ(),Z)
testPoint.setX(100.774)
testPoint.setY(59.0012)
testPoint.setZ(78.342)
elf.assertEqual(testPoint.getX(),100.774)
self.assertEqual(testPoint.getX(),59.0012)
self.assertEqual(testPoint.getX(),78.342)
#test vector
def testVectorMethods(self):
xv = 14.76
yv = -5.4321
zv = -9.426
testVector = vector(xv, yv, zv)
self.assertEqual(testVector.getX(), xv)
self.assertEqual(testVector.getY(), yv)
self.assertEqual(testVector.getZ(), zv)
#test drop calc
def testDropCalcMethods(self):
velVec = vector(9, 2, 0)
accelVec = vector(2,8,10)
projLoc = point(34.77,39.1110,65.78)
targetLoc = point(0,0,0) #origin
coeffD = 0.1 #coefficient of drag
chute_UGV_mass = 20 #kg?
chute_A = 60 #area in m^2?
chute_deploy_t = 5 #chute deploy testPointMethods
testDropCalc = dropCalculations(velVec,accelVec,projLoc,targetLoc,coeffD, chute_UGV_mass, chute_A, chute_deploy_t)
testDropCalc.updateLocation(1,2,3):
self.assertEqual(testDropCalc.projX,1)
self.assertEqual(testDropCalc.projY,2)
self.assertEqual(testDropCalc.projZ,3)
testDropCalc.updateVelocity(1,2,3):
self.assertEqual(testDropCalc.projvX,1)
self.assertEqual(testDropCalc.projvX,2)
self.assertEqual(testDropCalc.projvX,3)