def test_correctness(self):
        self.assertFalse(magic_square([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))
        self.assertTrue(magic_square([[4, 9, 2], [3, 5, 7], [8, 1, 6]]))

        self.assertFalse(magic_square([[23, 28, 22], [22, 24, 27], [27, 21, 25]]))

        self.assertFalse(magic_square([[1, 2, 3], [4, 1, 1], [1, 3, 1]]))
Example #2
0
 def test_magic_square(self):
     self.assertEqual(magic_square([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
                      False)
     self.assertEqual(magic_square([[4, 9, 2], [3, 5, 7], [8, 1, 6]]), True)
     self.assertEqual(
         magic_square([[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5],
                       [9, 6, 15, 4]]), True)
     self.assertEqual(
         magic_square([[23, 28, 21], [22, 24, 26], [27, 20, 25]]), True)
     self.assertEqual(
         magic_square([[16, 23, 17], [78, 32, 21], [17, 16, 15]]), False)
Example #3
0
 def test_problem_statement_cases(self):
     self.assertEqual(False, magic_square([[1, 2, 3], [4, 5, 6], [7, 8,
                                                                  9]]))
     self.assertEqual(True, magic_square([[4, 9, 2], [3, 5, 7], [8, 1, 6]]))
     self.assertEqual(
         True,
         magic_square([[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5],
                       [9, 6, 15, 4]]))
     self.assertEqual(
         True, magic_square([[23, 28, 21], [22, 24, 26], [27, 20, 25]]))
     self.assertEqual(
         False, magic_square([[16, 23, 17], [78, 32, 21], [17, 16, 15]]))
Example #4
0
 def test_with_luna_square(self):
     self.assertTrue(solution.magic_square(
         [[37, 78, 29, 70, 21, 62, 13, 54, 5],
          [6, 38, 79, 30, 71, 22, 63, 14, 46],
          [47, 7, 39, 80, 31, 72, 23, 55, 15],
          [16, 48, 8, 40, 81, 32, 64, 24, 56],
          [57, 17, 49, 9, 41, 73, 33, 65, 25],
          [26, 58, 18, 50, 1, 42, 74, 34, 66],
          [67, 27, 59, 10, 51, 2, 43, 75, 35],
          [36, 68, 19, 60, 11, 52, 3, 44, 76],
          [77, 28, 69, 20, 61, 12, 53, 4, 45]]))
 def test_false(self):
     self.assertFalse(magic_square([[16, 23, 17], [78, 32, 21], [17, 16, 15]]))
 def test_magic_square(self):
     self.assertEqual(False, magic_square([[1,2,3], [4,5,6], [7,8,9]]))
     self.assertEqual(True, magic_square([[4,9,2], [3,5,7], [8,1,6]]))
     self.assertEqual(True, magic_square([[7,12,1,14], [2,13,8,11], [16,3,10,5], [9,6,15,4]]))
     self.assertEqual(True, magic_square([[23, 28, 21], [22, 24, 26], [27, 20, 25]]))
     self.assertEqual(False, magic_square([[16, 23, 17], [78, 32, 21], [17, 16, 15]]))
Example #7
0
 def test2(self):
     self.assertEqual(True, magic_square([[7,12,1,14], [2,13,8,11], [16,3,10,5], [9,6,15,4]]))
Example #8
0
 def test_magic_square1(self):
     self.assertEqual(
         True, solution.magic_square([[4, 9, 2], [3, 5, 7], [8, 1, 6]]))
Example #9
0
 def test_magic_square4(self):
     self.assertEqual(
         True,
         solution.magic_square([[23, 28, 21], [22, 24, 26], [27, 20, 25]]))
 def test_magic_square_2nd(self):
     self.assertEqual(True, solution.magic_square([[4,9,2], [3,5,7], [8,1,6]]))
 def test_magic_square_5th(self):
     self.assertEqual(False, solution.magic_square([[16, 23, 17], [78, 32, 21], [17, 16, 15]]))
Example #12
0
 def test_magicSquare(self):
     self.assertTrue(magic_square([[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5], [9, 6, 15, 4]]))
     self.assertTrue(magic_square([[4, 9, 2], [3, 5, 7], [8, 1, 6]]))
     self.assertTrue([[23, 28, 21], [22, 24, 26], [27, 20, 25]])
Example #13
0
 def test_false(self):
     self.assertFalse(
         magic_square([[16, 23, 17], [78, 32, 21], [17, 16, 15]]))
Example #14
0
 def test_with_my_non_magic_square(self):
     self.assertFalse(solution.magic_square([[1, 2, 3],
                                             [4, 5, 6],
                                             [7, 8, 9]]))
Example #15
0
 def test_two(self):
     self.assertEquals(magic_square([[4, 9, 2], [3, 5, 7], [8, 1, 6]]),
                       True)
Example #16
0
 def test_one(self):
     self.assertEquals(magic_square([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
                       False)
Example #17
0
 def test_five(self):
     self.assertEquals(
         magic_square([[16, 23, 17], [78, 32, 21], [17, 16, 15]]), False)
Example #18
0
	def test_magic_square_0(self):
		self.assertEqual(False, magic_square([[1,2,3], [4,5,6], [7,8,9]]))
Example #19
0
 def test_magic_square3(self):
     self.assertTrue(solution.magic_square([[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5], [9, 6, 15, 4]]))
Example #20
0
 def test_foure(self):
     self.assertEquals(
         magic_square([[23, 28, 21], [22, 24, 26], [27, 20, 25]]), True)
Example #21
0
 def test_magic_square4(self):
     self.assertTrue(solution.magic_square([[23, 28, 21], [22, 24, 26], [27, 20, 25]]))
 def test_magic_square_1st(self):
     self.assertEqual(False, solution.magic_square([[1,2,3], [4,5,6], [7,8,9]]))
Example #23
0
 def test_magic_square5(self):
     self.assertTrue(not solution.magic_square([[16, 23, 17], [78, 32, 21], [17, 16, 15]]))
Example #24
0
 def test_magic_square3(self):
     self.assertEqual(
         True,
         solution.magic_square([[7, 12, 1, 14], [2, 13, 8, 11],
                                [16, 3, 10, 5], [9, 6, 15, 4]]))
Example #25
0
 def test_magic_square1(self):
     self.assertTrue(not solution.magic_square([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))
Example #26
0
 def test_magic_square5(self):
     self.assertEqual(
         False,
         solution.magic_square([[16, 23, 17], [78, 32, 21], [17, 16, 15]]))
Example #27
0
 def test_magic_square2(self):
     self.assertTrue(solution.magic_square([[4, 9, 2], [3, 5, 7], [8, 1, 6]]))
Example #28
0
 def test_magic_square2(self):
     self.assertEqual(
         False, solution.magic_square([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))
Example #29
0
 def test_magic_sqare(self):
     self.assertFalse(
         solution.magic_square([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))
     self.assertTrue(
         solution.magic_square([[4, 9, 2], [3, 5, 7], [8, 1, 6]]))
Example #30
0
 def test1(self):
     self.assertEqual(True, magic_square([[4,9,2], [3,5,7], [8,1,6]]))
Example #31
0
 def test_true(self):
     self.assertTrue(magic_square([[4, 9, 2], [3, 5, 7], [8, 1, 6]]))
 def test_true(self):
     self.assertTrue(magic_square([[4,9,2], [3,5,7], [8,1,6]]))
 def test_magic_square_3rd(self):
     self.assertEqual(True, solution.magic_square([[7,12,1,14], [2,13,8,11], [16,3,10,5], [9,6,15,4]]))
Example #34
0
	def test_magic_square_2(self):
		self.assertEqual(False, magic_square([[16, 23, 17], [78, 32, 21], [17, 16, 15]]))
 def test_magic_square_4th(self):
     self.assertEqual(True, solution.magic_square([[23, 28, 21], [22, 24, 26], [27, 20, 25]]))
Example #36
0
	def test_magic_square_1(self):
		self.assertEqual(True, magic_square([[23, 28, 21], [22, 24, 26], [27, 20, 25]]))
Example #37
0
 def test_three(self):
     self.assertEquals(
         magic_square([[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5],
                       [9, 6, 15, 4]]), True)