예제 #1
0
 def test_has_no_solutions(self):
     m = [
         [2, 4, 6],
         [2, 4, 7],
     ]
     solution = solve(m)
     self.assertFalse(solution)
예제 #2
0
 def test_yields_correct_solution(self):
     m = [
         [2, 2, 8],
         [2, -2, 0],
     ]
     solution = solve(m)
     s = solution()
     self.assertEqual(s, (2, 2))
예제 #3
0
 def test_has_many_solutions(self):
     m = [
         [2, 2, 8],
         [1, 1, 4],
     ]
     solution = solve(m)
     self.assertTrue(solution)
     self.assertFalse(solution.exact)
예제 #4
0
 def test_has_exact_solution(self):
     m = [
         [2, 2, 8],
         [2, -2, 0],
     ]
     solution = solve(m)
     self.assertTrue(solution)
     self.assertTrue(solution.exact)
예제 #5
0
 def test_yields_different_solutions_for_different_input(self):
     m = [
         [2, 2, 8],
         [1, 1, 4],
     ]
     solution = solve(m)
     s1 = solution(1)
     s2 = solution(2)
     self.assertNotEqual(s1, s2)