def test_generate_bisymmetric_is_correct(self): result = BisymmetricMatrix() result.generate_bisymmetric_matrix_by_vector([1, 2, 3, 4, 5, 6]) correct_bisymmetric_matrix = [[1, 2, 3, 4], [2, 5, 6, 3], [3, 6, 5, 2], [4, 3, 2, 1]] for i in range(4): for j in range(4): self.assertEqual(result[i][j], correct_bisymmetric_matrix[i][j])
def create_matrix_by_vector(self): self.created_matrix_by_vector.clear() if self.button_convert_state == 'normal': matrix = BisymmetricMatrix() self.matrix_size = is_correct_vector_size(len(self.vector)) self.set_created_matrix_by_vector( matrix.generate_bisymmetric_matrix_by_vector(self.vector))
def test_generate_bisymmetric_is_bisymmetric(self): correct_bisymmetric_matrix = BisymmetricMatrix() correct_bisymmetric_matrix.generate_bisymmetric_matrix_by_vector( [1, 2, 3, 4]) self.assertTrue(correct_bisymmetric_matrix.is_bisymmetric())
def test_generate_by_0_size_vector_is_bisymmetric(self): empty_matrix = BisymmetricMatrix() empty_matrix.generate_bisymmetric_matrix_by_vector([]) self.assertTrue(empty_matrix.is_bisymmetric())