test_compression.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import sys
3 import rospy
4 import rosunit
5 import unittest
6 
7 from rosbridge_library.internal import pngcompression
8 
9 
10 PKG = 'rosbridge_library'
11 NAME = 'test_compression'
12 
13 
14 class TestCompression(unittest.TestCase):
15 
16  def setUp(self):
17  rospy.init_node(NAME)
18 
19  def test_compress(self):
20  bytes = list(range(128)) * 10000
21  string = str(bytearray(bytes))
22  encoded = pngcompression.encode(string)
23  self.assertNotEqual(string, encoded)
24 
26  bytes = list(range(128)) * 10000
27  string = str(bytearray(bytes))
28  encoded = pngcompression.encode(string)
29  self.assertNotEqual(string, encoded)
30  decoded = pngcompression.decode(encoded)
31  self.assertEqual(string, decoded)
32 
33 
34 if __name__ == '__main__':
35  rosunit.unitrun(PKG, NAME, TestCompression)
36 


rosbridge_library
Author(s): Jonathan Mace
autogenerated on Fri Oct 21 2022 02:45:18