Example #1
0
 def test_struct(self):
     # note any strings here get converted to 'H' arrays!
     mydata = tuple()
     f = parse_dm3.dm_types[parse_dm3.get_dmtype_for_name('struct')]
     self.check_write_then_read_matches(mydata, f)
     mydata = (3, 4, 56.7)
     self.check_write_then_read_matches(mydata, f)
Example #2
0
 def test_array_struct(self):
     dat = parse_dm3.structarray(['h', 'h', 'h'])
     dat.raw_data = array.array('b', [0, 0] * 3 * 8)  # two bytes x 3 'h's x 8 elements
     self.check_write_then_read_matches(dat, parse_dm3.dm_types[parse_dm3.get_dmtype_for_name('array')])
Example #3
0
 def test_read_string(self):
     data = "MyString"
     ret = self.check_write_then_read_matches(data, parse_dm3.dm_types[parse_dm3.get_dmtype_for_name('array')], False)
     self.assertEqual(data, dm3_image_utils.fix_strings(ret))
Example #4
0
 def test_array_simple(self):
     dat = array.array('b', [0]*256)
     self.check_write_then_read_matches(dat, parse_dm3.dm_types[parse_dm3.get_dmtype_for_name('array')])
Example #5
0
 def test_simpledata(self):
     self.check_write_then_read_matches(45, parse_dm3.dm_types[parse_dm3.get_dmtype_for_name('long')])
     self.check_write_then_read_matches(2**30, parse_dm3.dm_types[parse_dm3.get_dmtype_for_name('uint')])
     self.check_write_then_read_matches(34.56, parse_dm3.dm_types[parse_dm3.get_dmtype_for_name('double')])