Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import sys
00019 sys.path.insert(1,"../")
00020
00021 import unittest
00022 import OpenRTM_aist
00023
00024 from BufferBase import *
00025
00026 class TestNullBuffer(unittest.TestCase):
00027 def setUp(self):
00028 self.nb = NullBuffer()
00029 self.nb.init(100)
00030
00031 def tearDown(self):
00032 OpenRTM_aist.Manager.instance().shutdownManager()
00033 return
00034
00035 def test_length(self):
00036 self.assertEqual(self.nb.length(),1)
00037
00038
00039 def test_write(self):
00040 data=[0]
00041
00042 self.assertEqual(self.nb.write(10000), True)
00043 self.nb.read(data)
00044 self.assertEqual(data[0], 10000)
00045
00046
00047 self.assertEqual(self.nb.write(1.2345), True)
00048 self.nb.read(data)
00049 self.assertEqual(data[0], 1.2345)
00050
00051
00052 self.assertEqual(self.nb.write("test"), True)
00053 self.nb.read(data)
00054 self.assertEqual(data[0], "test")
00055
00056
00057 self.assertEqual(self.nb.write([1,2,3]), True)
00058 self.nb.read(data)
00059 self.assertEqual(data[0], [1,2,3])
00060
00061
00062 def test_isEmpty(self):
00063 self.assertEqual(self.nb.isEmpty(),False)
00064
00065
00066 def test_isNew(self):
00067 data=[0]
00068 self.assertEqual(self.nb.isNew(),False)
00069 self.nb.read(data)
00070 self.assertEqual(self.nb.isNew(),False)
00071 self.assertEqual(self.nb.write(10000), True)
00072 self.assertEqual(self.nb.isNew(),True)
00073
00074
00075
00076 if __name__ == '__main__':
00077 unittest.main()