|
@@ -25,6 +25,12 @@ class SinkTestCase(unittest.TestCase):
|
25
|
25
|
self.obj_range = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
26
|
26
|
flags=pdbuddy.SinkFlags.HV_PREFERRED, v=13800, vmin=12000,
|
27
|
27
|
vmax=16000, i=2000, idim=pdbuddy.SinkDimension.CURRENT)
|
|
28
|
+ self.obj_valid_p = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
|
29
|
+ flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=None, vmax=None,
|
|
30
|
+ i=35000, idim=pdbuddy.SinkDimension.POWER)
|
|
31
|
+ self.obj_valid_r = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
|
32
|
+ flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=None, vmax=None,
|
|
33
|
+ i=10000, idim=pdbuddy.SinkDimension.RESISTANCE)
|
28
|
34
|
|
29
|
35
|
self.obj_huge_v = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
30
|
36
|
flags=pdbuddy.SinkFlags.NONE, v=65536, vmin=None, vmax=None,
|
|
@@ -50,6 +56,13 @@ class SinkTestCase(unittest.TestCase):
|
50
|
56
|
flags=pdbuddy.SinkFlags.NONE, v=5000, vmin=None, vmax=None,
|
51
|
57
|
i=-1, idim=pdbuddy.SinkDimension.CURRENT)
|
52
|
58
|
|
|
59
|
+ self.obj_neg_p = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
|
60
|
+ flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=None, vmax=None,
|
|
61
|
+ i=-1, idim=pdbuddy.SinkDimension.POWER)
|
|
62
|
+ self.obj_neg_r = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
|
63
|
+ flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=None, vmax=None,
|
|
64
|
+ i=-1, idim=pdbuddy.SinkDimension.RESISTANCE)
|
|
65
|
+
|
53
|
66
|
def tearDown(self):
|
54
|
67
|
# Close the connection to the PD Buddy Sink
|
55
|
68
|
self.pdbs.close()
|
|
@@ -79,6 +92,14 @@ class SinkTestCase(unittest.TestCase):
|
79
|
92
|
self.pdbs.set_tmpcfg(self.obj_range)
|
80
|
93
|
self.assertEqual(self.pdbs.get_tmpcfg(), self.obj_range)
|
81
|
94
|
|
|
95
|
+ def test_set_tmpcfg_valid_p(self):
|
|
96
|
+ self.pdbs.set_tmpcfg(self.obj_valid_p)
|
|
97
|
+ self.assertEqual(self.pdbs.get_tmpcfg(), self.obj_valid_p)
|
|
98
|
+
|
|
99
|
+ def test_set_tmpcfg_valid_r(self):
|
|
100
|
+ self.pdbs.set_tmpcfg(self.obj_valid_r)
|
|
101
|
+ self.assertEqual(self.pdbs.get_tmpcfg(), self.obj_valid_r)
|
|
102
|
+
|
82
|
103
|
def test_set_tmpcfg_huge_v(self):
|
83
|
104
|
with self.assertRaises(ValueError):
|
84
|
105
|
self.pdbs.set_tmpcfg(self.obj_huge_v)
|
|
@@ -107,6 +128,14 @@ class SinkTestCase(unittest.TestCase):
|
107
|
128
|
with self.assertRaises(ValueError):
|
108
|
129
|
self.pdbs.set_tmpcfg(self.obj_neg_i)
|
109
|
130
|
|
|
131
|
+ def test_set_tmpcfg_neg_p(self):
|
|
132
|
+ with self.assertRaises(ValueError):
|
|
133
|
+ self.pdbs.set_tmpcfg(self.obj_neg_p)
|
|
134
|
+
|
|
135
|
+ def test_set_tmpcfg_neg_r(self):
|
|
136
|
+ with self.assertRaises(ValueError):
|
|
137
|
+ self.pdbs.set_tmpcfg(self.obj_neg_r)
|
|
138
|
+
|
110
|
139
|
def test_write(self):
|
111
|
140
|
self.test_set_tmpcfg_valid()
|
112
|
141
|
self.pdbs.write()
|