<filename>Codefights/arcade/intro/level-12/55.Different-Squares/Python/test.py<gh_stars>1-10
# Python3

from solution1 import differentSquares as f

qa = [
    ([[1,2,1],
      [2,2,2],
      [2,2,2],
      [1,2,3],
      [2,2,1]], 6),
    ([[9,9,9,9,9],
      [9,9,9,9,9],
      [9,9,9,9,9],
      [9,9,9,9,9],
      [9,9,9,9,9],
      [9,9,9,9,9]], 1),
    ([[3]], 0),
    ([[3,4,5,6,7,8,9]], 0),
    ([[3],
      [4],
      [5],
      [6],
      [7]], 0),
    ([[2,5,3,4,3,1,3,2],
      [4,5,4,1,2,4,1,3],
      [1,1,2,1,4,1,1,5],
      [1,3,4,2,3,4,2,4],
      [1,5,5,2,1,3,1,1],
      [1,2,3,3,5,1,2,4],
      [3,1,4,4,4,1,5,5],
      [5,1,3,3,1,5,3,5],
      [5,4,4,3,5,4,4,4]], 54),
    ([[1,1,1,1,1,1,2,2,2,3,3,3,9,9,9,2,3,9]], 0),
]

for *q, a in qa:
    for i, e in enumerate(q):
        print('input{0}: {1}'.format(i + 1, e))
    ans = f(*q)
    if ans != a:
        print('  [failed]')
        print('    output:', ans)
        print('    expected:', a)
    else:
        print('  [ok]')
        print('    output:', ans)
    print()

<filename>Codefights/arcade/intro/level-12/55.Different-Squares/Python/test.py<gh_stars>1-10
# Python3

from solution1 import differentSquares as f

qa = [
    ([[1,2,1],
      [2,2,2],
      [2,2,2],
      [1,2,3],
      [2,2,1]], 6),
    ([[9,9,9,9,9],
      [9,9,9,9,9],
      [9,9,9,9,9],
      [9,9,9,9,9],
      [9,9,9,9,9],
      [9,9,9,9,9]], 1),
    ([[3]], 0),
    ([[3,4,5,6,7,8,9]], 0),
    ([[3],
      [4],
      [5],
      [6],
      [7]], 0),
    ([[2,5,3,4,3,1,3,2],
      [4,5,4,1,2,4,1,3],
      [1,1,2,1,4,1,1,5],
      [1,3,4,2,3,4,2,4],
      [1,5,5,2,1,3,1,1],
      [1,2,3,3,5,1,2,4],
      [3,1,4,4,4,1,5,5],
      [5,1,3,3,1,5,3,5],
      [5,4,4,3,5,4,4,4]], 54),
    ([[1,1,1,1,1,1,2,2,2,3,3,3,9,9,9,2,3,9]], 0),
]

for *q, a in qa:
    for i, e in enumerate(q):
        print('input{0}: {1}'.format(i + 1, e))
    ans = f(*q)
    if ans != a:
        print('  [failed]')
        print('    output:', ans)
        print('    expected:', a)
    else:
        print('  [ok]')
        print('    output:', ans)
    print()
