summaryrefslogtreecommitdiff
path: root/cesar/maximus/python/test/test_lib_proto.py
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/maximus/python/test/test_lib_proto.py')
-rw-r--r--cesar/maximus/python/test/test_lib_proto.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/cesar/maximus/python/test/test_lib_proto.py b/cesar/maximus/python/test/test_lib_proto.py
index f97f26deb4..46ca81989a 100644
--- a/cesar/maximus/python/test/test_lib_proto.py
+++ b/cesar/maximus/python/test/test_lib_proto.py
@@ -36,7 +36,7 @@ param1 = pack('iiB',1,2,True)
fc1.add_param("param_1", param1)
param2 = pack('iiiiiiiiii',0,1,2,3,4,5,6,7,8,9)
fc1.add_param("param_2", param2)
-param3 = "hello"
+param3 = "hello\0"
fc1.add_param("param_3", param3)
param4 = pack('q',123)
fc1.add_param("param_4", param4)
@@ -63,7 +63,7 @@ param7 = probe2.bind_param("param_7")
print "RESULT: param 7 =",param7
probe2.send(stationC)
-if None == param7:
+if param7 is not None:
fc3 = maximus.create_fcall("function_3")
fc3.send_async(stationC)
@@ -123,8 +123,7 @@ class TestFcallFunctions(unittest.TestCase):
def setUp(self):
# Create Maximus
- self.maximus = MaximusProto(UNIT_TEST=True)
- self.maximus.init(sys.argv)
+ self.maximus = maximus
# Create a station
self.station = StaProto("11:22:33:44:55:66")
@@ -267,7 +266,7 @@ class TestFcallFunctions(unittest.TestCase):
fcall1.add_param("param_2", param2)
# Add a third parameter to the created message
- param3 = "hello"
+ param3 = "hello\0"
fcall1.add_param("param_3", param3)
# Add a fourth parameter to the created message
@@ -304,8 +303,9 @@ class TestFcallFunctions(unittest.TestCase):
fcall2 = self.maximus.create_fcall("function_2")
fcall2.add_param_bool("param_5", True)
fcall2 = fcall2.send(self.station)
- param5 = fcall2.bind_param_bool("param_5")
- self.assertEqual(param5,True)
+ result1 = fcall2.bind_param_string("result_1")
+ self.assertEqual(result1,"this is result 1")
+ self.assertEqual(len(result1),16)
# Create a probe message,
# set the destination station,
@@ -313,8 +313,8 @@ class TestFcallFunctions(unittest.TestCase):
# send the message,
# and get the result
#
- probe = self.maximus.create_probe().set_sta(self.station).add_param_ulong("param_6",0x7B000000).send()
- self.assertEqual(probe.bind_param_ulong("param_6"),0x7B000000)
+ probe = self.maximus.create_probe().set_sta(self.station).add_param("param_6").send()
+ self.assertEqual(probe.bind_param_ulong("param_6"),0x0000007B)
def test_is_param(self):
@@ -355,8 +355,8 @@ class TestFcallFunctions(unittest.TestCase):
# and get the result
#
probe = self.maximus.create_probe()
- probe = probe.add_param_ushort("param_10",0xEEFF).send(self.station)
- self.assertEqual(probe.bind_param_ushort("param_10"),0xEEFF)
+ probe = probe.add_param("param_10").send(self.station)
+ self.assertEqual(probe.bind_param_ushort("param_10"),0xFFEE)
def test_bind_param_ulong(self):
@@ -365,15 +365,15 @@ class TestFcallFunctions(unittest.TestCase):
# and get the result
#
probe = self.maximus.create_probe()
- probe = probe.add_param_ulong("param_11",0xCCDDEEFF).send(self.station)
- self.assertEqual(probe.bind_param_ulong("param_11"),0xCCDDEEFF)
+ probe = probe.add_param("param_11").send(self.station)
+ self.assertEqual(probe.bind_param_ulong("param_11"),0xFFEEDDCC)
suite = unittest.TestLoader().loadTestsFromTestCase(TestFcallFunctions)
class TestMaximusProtoFunctions(unittest.TestCase):
def setUp(self):
- self.m = MaximusProto()
+ self.m = maximus
def tearDown(self):
pass
@@ -412,3 +412,6 @@ except ValueError:
if __name__ == '__main__':
testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+
+# To stop proto executable in case of unitary tests
+maximus.background.stop()