def test_write_terminator_standard_value_i3(): # See ISO/IEC 18004:2006(E) -- I.3 Encoding a Micro QR Code symbol (page 96) data = bits('01000000000110001010110011000011') buff = Buffer(data) version = consts.VERSION_M2 capacity = consts.SYMBOL_CAPACITY[version][consts.ERROR_LEVEL_L] encoder.write_terminator(buff, capacity, version, len(data)) assert data + bits('00000') == buff.getbits()
def test_write_terminator_standard_value_i2(): # See ISO/IEC 18004:2006(E) -- I.2 Encoding a QR Code symbol (page 94) data = bits('000100000010000000001100010101100110000110000') buff = Buffer(data) version = 1 v = None capacity = consts.SYMBOL_CAPACITY[version][consts.ERROR_LEVEL_M] encoder.write_terminator(buff, capacity, v, len(data)) assert data + bits('0000') == buff.getbits()
def test_write_terminator_thonky(): # <http://www.thonky.com/qr-code-tutorial/data-encoding/#add-a-terminator-of-0s-if-necessary> data = bits('00100000010110110000101101111000110100010111001011011100010011010100001101') buff = Buffer(data) version = 1 v = None capacity = consts.SYMBOL_CAPACITY[version][consts.ERROR_LEVEL_Q] encoder.write_terminator(buff, capacity, v, len(data)) assert data + bits('0000') == buff.getbits()