Beispiel #1
0
def test_codeword_placement_iso_i3():
    # ISO/IEC 18004:2015(E) - page 96
    # 01234567 as M2-L symbol
    s = '01000000 00011000 10101100 11000011 00000000'
    codewords = Buffer(bits(s)).toints()
    version = consts.VERSION_M2
    buff = encoder.make_final_message(version, consts.ERROR_LEVEL_L, codewords)
    expected_s = '01000000 00011000 10101100 11000011 00000000 10000110 00001101 00100010 10101110 00110000'
    expected = bits(expected_s)
    assert expected == buff.getbits()
    matrix = encoder.make_matrix(version)
    encoder.add_finder_patterns(matrix, is_micro=version < 1)
    encoder.add_codewords(matrix, buff, version=version)
    ref_matrix = read_matrix('iso-i3_code_placement')
    assert ref_matrix == matrix
Beispiel #2
0
def test_codeword_placement_iso_i3():
    # ISO/IEC 18004:2015(E) - page 96
    # 01234567 as M2-L symbol
    s = '01000000 00011000 10101100 11000011 00000000'
    codewords = Buffer(bits(s)).toints()
    version = consts.VERSION_M2
    buff = encoder.make_final_message(version, consts.ERROR_LEVEL_L, codewords)
    expected_s = '01000000 00011000 10101100 11000011 00000000 10000110 00001101 00100010 10101110 00110000'
    expected = bits(expected_s)
    assert expected == buff.getbits()
    matrix = encoder.make_matrix(version)
    encoder.add_finder_patterns(matrix, is_micro=version < 1)
    encoder.add_codewords(matrix, buff, version=version)
    ref_matrix = read_matrix('iso-i3_code_placement')
    assert ref_matrix == matrix
def test_codeword_placement_iso_i2():
    # ISO/IEC 18004:2015(E) - page 94
    # 01234567 as 1-M symbol
    s = '00010000 00100000 00001100 01010110 01100001 10000000 11101100 00010001 ' \
        '11101100 00010001 11101100 00010001 11101100 00010001 11101100 00010001'
    codewords = Buffer(bits(s))
    version = 1
    buff = encoder.make_final_message(version, consts.ERROR_LEVEL_M, codewords)
    expected_s = '00010000 00100000 00001100 01010110 01100001 10000000 11101100 ' \
                 '00010001 11101100 00010001 11101100 00010001 11101100 00010001 ' \
                 '11101100 00010001 10100101 00100100 11010100 11000001 11101101 ' \
                 '00110110 11000111 10000111 00101100 01010101'
    expected = bits(expected_s)
    assert expected == buff.getbits()
    matrix = encoder.make_matrix(version)
    encoder.add_finder_patterns(matrix, is_micro=version < 1)
    encoder.add_codewords(matrix, buff, version=version)
    ref_matrix = read_matrix('iso-i2_code_placement')
    assert ref_matrix == matrix