Beispiel #1
0
    def testGetBitSizeOfString(self):
        self.assertEqual((1 + 1) * 8, getBitSizeOfString("T"))
        self.assertEqual((1 + 4) * 8, getBitSizeOfString("TEST"))

        testStringLength = 1 << 7 # 2 bytes per character!
        testString = (b'\xc2\xAB' * testStringLength).decode("utf-8")
        self.assertEqual((2 + 2 * testStringLength) * 8, getBitSizeOfString(testString))
Beispiel #2
0
    def bitSizeOf(_bitPosition, value):
        """
        Returns length of Zserio string type stored in the bit stream in bits.

        :param _bitPosition: Not used.
        :param value: Zserio string type value.
        :returns: Length of given Zserio string type in bits.
        """

        return getBitSizeOfString(value)