Exemple #1
0
def test_thonky_pattern_2():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-2')
    matrix_size = len(matrix)
    assert 206 == encoder.score_n1(matrix, matrix_size)
    assert 141 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 160
    assert 800 == encoder.score_n3(matrix, matrix_size)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    assert 507 - 160 + 800 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #2
0
def test_thonky_pattern_2():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-2')
    matrix_size = len(matrix)
    assert 206 == encoder.score_n1(matrix, matrix_size)
    assert 141 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 160
    assert 800 == encoder.score_n3(matrix, matrix_size)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    assert 507 - 160 + 800 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #3
0
def test_thonky_pattern_7():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-7')
    matrix_size = len(matrix)
    assert 197 == encoder.score_n1(matrix, matrix_size)
    assert 123 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 200
    assert 720 == encoder.score_n3(matrix, matrix_size)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    # See score 3
    assert 520 - 200 + 720 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #4
0
def test_thonky_pattern_3():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-3')
    matrix_size = len(matrix)
    assert 180 == encoder.score_n1(matrix, matrix_size)
    assert 141 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 120
    assert 760 == encoder.score_n3(matrix, matrix_size)
    # Thonky: 2, but that's impossible: Either 0 or a multiple of 10 (N4 = 10)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    assert 443 - 2 - 120 + 760 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #5
0
def test_thonky_pattern_1():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-1')
    matrix_size = len(matrix)
    assert 172 == encoder.score_n1(matrix, matrix_size)
    assert 129 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 120
    assert 760 == encoder.score_n3(matrix, matrix_size)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    # See score 3
    assert 421 - 120 + 760 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #6
0
def test_thonky_pattern_0():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-0')
    matrix_size = len(matrix)
    assert 180 == encoder.score_n1(matrix, matrix_size)
    assert 90 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 80
    assert 760 == encoder.score_n3(matrix, matrix_size)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    # See score 3
    assert 350 - 80 + 760 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #7
0
def test_thonky_pattern_7():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-7')
    matrix_size = len(matrix)
    assert 197 == encoder.score_n1(matrix, matrix_size)
    assert 123 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 200
    assert 720 == encoder.score_n3(matrix, matrix_size)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    # See score 3
    assert 520 - 200 + 720 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #8
0
def test_thonky_pattern_3():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-3')
    matrix_size = len(matrix)
    assert 180 == encoder.score_n1(matrix, matrix_size)
    assert 141 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 120
    assert 760 == encoder.score_n3(matrix, matrix_size)
    # Thonky: 2, but that's impossible: Either 0 or a multiple of 10 (N4 = 10)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    assert 443 - 2 - 120 + 760 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #9
0
def test_thonky_pattern_1():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-1')
    matrix_size = len(matrix)
    assert 172 == encoder.score_n1(matrix, matrix_size)
    assert 129 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 120
    assert 760 == encoder.score_n3(matrix, matrix_size)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    # See score 3
    assert 421 - 120 + 760 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #10
0
def test_thonky_pattern_0():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-0')
    matrix_size = len(matrix)
    assert 180 == encoder.score_n1(matrix, matrix_size)
    assert 90 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 80
    assert 760 == encoder.score_n3(matrix, matrix_size)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    # See score 3
    assert 350 - 80 + 760 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #11
0
def test_thonky_pattern_6():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-6')
    matrix_size = len(matrix)
    assert 171 == encoder.score_n1(matrix, matrix_size)
    assert 102 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 80
    assert 840 == encoder.score_n3(matrix, matrix_size)
    # Thonky: 4, but that's impossible: Either 0 or a multiple of 10 (N4 = 10)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    # See score 3 and 4
    assert 357 - 4 - 80 + 840 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #12
0
def test_thonky_pattern_5():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-5')
    matrix_size = len(matrix)
    assert 189 == encoder.score_n1(matrix, matrix_size)
    assert 156 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 200
    assert 800 == encoder.score_n3(matrix, matrix_size)
    # Thonky: 2, but that's impossible: Either 0 or a multiple of 10 (N4 = 10)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    # See score 3 and 4
    assert 547 - 2 - 200 + 800 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #13
0
def test_thonky_pattern_6():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-6')
    matrix_size = len(matrix)
    assert 171 == encoder.score_n1(matrix, matrix_size)
    assert 102 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 80
    assert 840 == encoder.score_n3(matrix, matrix_size)
    # Thonky: 4, but that's impossible: Either 0 or a multiple of 10 (N4 = 10)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    # See score 3 and 4
    assert 357 - 4 - 80 + 840 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #14
0
def test_thonky_pattern_5():
    # http://www.thonky.com/qr-code-tutorial/data-masking
    matrix = read_matrix('thonky_datamasking_mask-5')
    matrix_size = len(matrix)
    assert 189 == encoder.score_n1(matrix, matrix_size)
    assert 156 == encoder.score_n2(matrix, matrix_size)
    # Thonky: 200
    assert 800 == encoder.score_n3(matrix, matrix_size)
    # Thonky: 2, but that's impossible: Either 0 or a multiple of 10 (N4 = 10)
    assert 0 == encoder.score_n4(matrix, matrix_size)
    # See score 3 and 4
    assert 547 - 2 - 200 + 800 == encoder.evaluate_mask(matrix, matrix_size)
Exemple #15
0
def test_score_n3():
    matrix, matrix_size = make_thonky_score_matrix()
    score = encoder.score_n3(matrix, matrix_size)
    # Thonky: 80
    assert 760 == score
Exemple #16
0
def test_score_n3():
    matrix, matrix_size = make_thonky_score_matrix()
    score = encoder.score_n3(matrix, matrix_size)
    # Thonky: 80
    assert 760 == score