Move root car to pycar, put other pycar back to car.
This commit is contained in:
33
pycar/tests/test_algorithms.py
Normal file
33
pycar/tests/test_algorithms.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import unittest
|
||||
import car.tracking as tracking
|
||||
from car.tracking.devices.mock_lidar import MockLidar
|
||||
import car.tracking.lidar_loader as loader
|
||||
|
||||
class TestAlgorithms(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.lidar = MockLidar(iter(loader.get_scans('../src/car/tracking/out.pickle')))
|
||||
|
||||
def test_find_centre(self):
|
||||
# e.g.
|
||||
#self.assertEqual
|
||||
pass
|
||||
|
||||
def test_convert_lidar_cartesian(self):
|
||||
pass
|
||||
|
||||
def test_convert_cartesian_lidar(self):
|
||||
pass
|
||||
|
||||
def test_calc_groups_runs(self):
|
||||
pass
|
||||
|
||||
def test_group_changing(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
8
pycar/tests/test_ballot_voter.py
Normal file
8
pycar/tests/test_ballot_voter.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import unittest
|
||||
from DecisionSystem.CentralisedDecision.ballotvoter import BallotVoter
|
||||
|
||||
class TestBallotVoter(unittest.TestCase):
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
|
||||
13
pycar/tests/test_commander.py
Normal file
13
pycar/tests/test_commander.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import unittest
|
||||
import Messaging.mqttsession as ms
|
||||
|
||||
class TestCommander(unittest.TestCase):
|
||||
ms.client = FakeMQTT()
|
||||
|
||||
class FakeMQTT:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def add_subsc
|
||||
|
||||
30
pycar/tests/test_hand_recogniser.py
Normal file
30
pycar/tests/test_hand_recogniser.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import unittest
|
||||
from GestureRecognition.simplehandrecogniser import SimpleHandRecogniser
|
||||
import cv2
|
||||
|
||||
class TestSimpleHandRecogniser(unittest.TestCase):
|
||||
|
||||
def test_5_digits(self):
|
||||
self.assertEqual(self.recogniser_5.get_gesture(), 5)
|
||||
|
||||
def test_3_digits(self):
|
||||
self.assertEqual(self.recogniser_3.get_gesture(), 3)
|
||||
|
||||
def test_s_photo(self):
|
||||
self.assertEqual(self.recogniser_s.get_gesture(), 5)
|
||||
|
||||
def setUp(self):
|
||||
img_3 = cv2.imread("/Users/piv/Documents/Projects/car/GestureRecognition/IMG_0825.jpg")
|
||||
img_3 = cv2.resize(img_3, None, fx=0.1, fy=0.1, interpolation = cv2.INTER_AREA)
|
||||
self.recogniser_3 = SimpleHandRecogniser(img_3)
|
||||
|
||||
img_5 = cv2.imread("/Users/piv/Documents/Projects/car/GestureRecognition/IMG_0818.png")
|
||||
img_5 = cv2.resize(img_5, None, fx=0.1, fy=0.1, interpolation = cv2.INTER_AREA)
|
||||
self.recogniser_5 = SimpleHandRecogniser(img_5)
|
||||
|
||||
# img_s = cv2.imread("/Users/piv/Documents/Projects/car/GestureRecognition/Screen Shot hand.png")
|
||||
# img_s = cv2.resize(img_s, None, fx=0.5, fy=0.5, interpolation = cv2.INTER_AREA)
|
||||
# self.recogniser_s = SimpleHandRecogniser(img_s)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
10
pycar/tests/test_lidar_cache.py
Normal file
10
pycar/tests/test_lidar_cache.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import unittest
|
||||
import car.tracking as tracking
|
||||
|
||||
class TestLidarCache(unittest.TestCase):
|
||||
|
||||
def test_fake_scanner(self):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
33
pycar/tests/test_messages.py
Normal file
33
pycar/tests/test_messages.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import unittest
|
||||
from DecisionSystem.messages import Message, deserialise, RequestLeader
|
||||
|
||||
class TestMessages(unittest.TestCase):
|
||||
def test_base_empty(self):
|
||||
self.assertEqual(self.m.sender, "")
|
||||
self.assertEqual(self.m.data, {})
|
||||
self.assertIsNone(self.m.type)
|
||||
|
||||
def test_base_set(self):
|
||||
self.m2.type = "Michael"
|
||||
self.assertEqual(self.m2.type, "Michael")
|
||||
self.assertEqual(self.m2.data, self.data)
|
||||
self.assertEqual(self.m2.sender, 33)
|
||||
|
||||
def test_serialistion(self):
|
||||
serialised = self.m2.serialise()
|
||||
self.m3 = deserialise(serialised)
|
||||
self.assertEqual(self.m2.sender, self.m3.sender)
|
||||
self.assertEqual(self.m2.data, self.m3.data)
|
||||
|
||||
def test_RequestLeader(self):
|
||||
self.m3 = RequestLeader()
|
||||
self.assertEqual(self.m3.type, "RequestLeader")
|
||||
|
||||
def setUp(self):
|
||||
self.m = Message()
|
||||
self.data = {"hi": 3}
|
||||
self.sender = 33
|
||||
self.m2 = Message(self.sender,self.data)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
21
pycar/tests/test_mqtt_voter.py
Normal file
21
pycar/tests/test_mqtt_voter.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import unittest
|
||||
from DecisionSystem.CentralisedDecision.ballotvoter import BallotVoter
|
||||
|
||||
class TestMqttVoter(unittest.TestCase):
|
||||
|
||||
def test_vote_property(self):
|
||||
self.assertTrue(self.voter.set_vote(Vote()))
|
||||
self.assertEquals(self.voter.get_vote(), Vote())
|
||||
|
||||
def test_invalid_vote_set(self):
|
||||
self.assertFalse(self.voter.set_vote("Hi"))
|
||||
|
||||
@unittest.skip
|
||||
def test_submit_vote(self):
|
||||
pass
|
||||
|
||||
def setUp(self):
|
||||
self.voter = MqttVoter()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user