test_compression.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import sys
00003 import rospy
00004 import rostest
00005 import unittest
00006 
00007 from rosbridge_library.internal import pngcompression
00008 
00009 
00010 class TestCompression(unittest.TestCase):
00011 
00012     def setUp(self):
00013         rospy.init_node("test_compression")
00014 
00015     def test_compress(self):
00016         bytes = list(range(128)) * 10000
00017         string = str(bytearray(bytes))
00018         encoded = pngcompression.encode(string)
00019         self.assertNotEqual(string, encoded)
00020 
00021     def test_compress_decompress(self):
00022         bytes = list(range(128)) * 10000
00023         string = str(bytearray(bytes))
00024         encoded = pngcompression.encode(string)
00025         self.assertNotEqual(string, encoded)
00026         decoded = pngcompression.decode(encoded)
00027         self.assertEqual(string, decoded)
00028 
00029 PKG = 'rosbridge_library'
00030 NAME = 'test_compression'
00031 if __name__ == '__main__':
00032     rostest.unitrun(PKG, NAME, TestCompression)
00033 


rosbridge_library
Author(s): Jonathan Mace
autogenerated on Thu Jun 6 2019 21:51:43