예제 #1
0
    def test_read_value_max_padding(self):
        encoding = (b'\x48\x00\x00\x00\x00\x00\x00\x00')
        self.stream = BytearrayStream(encoding)
        ts = TextString()
        ts.length = 0x01
        ts.read_value(self.stream)

        expected = 'H'
        self.assertEqual(expected, ts.value,
                         self.bad_read.format('value', expected, ts.value))
예제 #2
0
    def test_read_value_no_padding(self):
        encoding = (b'\x48\x65\x6C\x6C\x6F\x20\x57\x6F')
        self.stream = BytearrayStream(encoding)
        ts = TextString()
        ts.length = 0x08
        ts.read_value(self.stream)

        expected = 'Hello Wo'
        self.assertEqual(expected, ts.value,
                         self.bad_read.format('value', expected, ts.value))