Exemple #1
0
    def test_auto_label(self):
        # One word
        field = steel.Bytes(size=1)
        field.set_name('byte')
        self.assertEqual(field.label, 'byte')

        # Two words
        field = steel.Bytes(size=1)
        field.set_name('two_bytes')
        self.assertEqual(field.label, 'two bytes')
Exemple #2
0
 def setUp(self):
     self.field = steel.Bytes(size=1,
                              map={
                                  b'a': 'A',
                                  b'b': 'B',
                                  b'c': 'C',
                              })
 def test_decode(self):
     field = steel.Bytes(size=3)
     self.assertEqual(field.decode(b'abc'), b'abc')
Exemple #4
0
 class B(steel.Structure):
     field1 = steel.Bytes(size=3)
     field2 = steel.Bytes(size=3)
Exemple #5
0
 def test_manual_label(self):
     field = steel.Bytes(size=1, label='explicit')
     field.set_name('field')
     self.assertEqual(field.label, 'explicit')
Exemple #6
0
 class Test(steel.Structure):
     field1 = steel.Bytes(size=2)
     field2 = steel.Bytes(size=4)
     field3 = steel.Bytes(size=1)
Exemple #7
0
 class Test(steel.Structure):
     field1 = steel.Bytes(offset=2, size=2)
     field2 = steel.Bytes(offset=10, size=4)
     field3 = steel.Bytes(offset=16, size=1)