コード例 #1
0
 def test_equal_array(self):
     import numpy as np
     a = [1, 1, 1]
     b = [1, 1, 1]
     c = [0, 0, 0]
     d = np.full(3, 1)
     self.assertTrue(Board.array_equal(a, b))
     self.assertFalse(Board.array_equal(a, c))
     self.assertTrue(Board.array_equal(a, d))
コード例 #2
0
    def test_board_array_equal(self):

        setup = '''
from game_base.board import Board
a = ['x' for _ in range(10)]
b = ['o' for _ in range(10)]
'''
        stmt = '''
Board.array_equal(a,b)
Board.array_equal(a,a)
'''
        print("board:", timeit.timeit(setup=setup, stmt=stmt, number=100000))