test_load.py 1.48 KB
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
1
2
#!/usr/bin/env python2

3
4
import unittest

Carlos Mastalli's avatar
Carlos Mastalli committed
5
from unittest_utils import loadHyQ, loadICub, loadTalos, loadTalosArm, loadTiago, loadTiagoNoHand
Guilhem Saurel's avatar
Guilhem Saurel committed
6

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

class RobotTestCase(unittest.TestCase):
    ROBOT = None
    NQ = None
    NV = None

    def test_nq(self):
        model = self.ROBOT.model
        self.assertEqual(model.nq, self.NQ, "Wrong nq value.")

    def test_nv(self):
        model = self.ROBOT.model
        self.assertEqual(model.nv, self.NV, "Wrong nv value.")

    def test_q0(self):
Guilhem Saurel's avatar
Guilhem Saurel committed
22
23
        self.assertTrue(hasattr(self.ROBOT, "q0"), "It doesn't have q0")

24
25
26
27
28
29

class TalosArmTest(RobotTestCase):
    RobotTestCase.ROBOT = loadTalosArm()
    RobotTestCase.NQ = 7
    RobotTestCase.NV = 7

Guilhem Saurel's avatar
Guilhem Saurel committed
30

31
32
33
34
35
class TalosArmFloatingTest(RobotTestCase):
    RobotTestCase.ROBOT = loadTalosArm()
    RobotTestCase.NQ = 14
    RobotTestCase.NV = 13

Guilhem Saurel's avatar
Guilhem Saurel committed
36

37
38
39
40
41
class TalosTest(RobotTestCase):
    RobotTestCase.ROBOT = loadTalos()
    RobotTestCase.NQ = 39
    RobotTestCase.NV = 38

Guilhem Saurel's avatar
Guilhem Saurel committed
42

43
44
45
46
47
48
class HyQTest(RobotTestCase):
    RobotTestCase.ROBOT = loadHyQ()
    RobotTestCase.NQ = 19
    RobotTestCase.NV = 18


49
50
51
52
53
54
55
56
57
58
59
class TiagoTest(RobotTestCase):
    RobotTestCase.ROBOT = loadTiago()
    RobotTestCase.NQ = 50
    RobotTestCase.NV = 48


class TiagoNoHandTest(RobotTestCase):
    RobotTestCase.ROBOT = loadTiagoNoHand()
    RobotTestCase.NQ = 14
    RobotTestCase.NV = 12

Carlos Mastalli's avatar
Carlos Mastalli committed
60

61
class ICubTest(RobotTestCase):
62
    RobotTestCase.ROBOT = loadICub(reduced=False)
63
64
    RobotTestCase.NQ = 39
    RobotTestCase.NV = 38
65

Carlos Mastalli's avatar
Carlos Mastalli committed
66

67
68
if __name__ == '__main__':
    unittest.main()