示例#1
0
 def test_gcd_b_equal_to_zero(self):
     with self.assertRaises(ValueError):
         gcd(2, 0)
示例#2
0
 def test_gcd_a_equal_to_b(self):
     expected = 2
     actual = gcd(2, 2)
     self.assertEqual(expected, actual)
示例#3
0
 def test_gcd_both_negative(self):
     expected = -2
     actual = gcd(-4, -2)
     self.assertEqual(expected, actual)
示例#4
0
 def test_gcd_a_negative_b_positive(self):
     expected = 2
     actual = gcd(-4, 2)
     self.assertEqual(expected, actual)
示例#5
0
 def test_gcd_a_positive_b_negative(self):
     expected = -2
     actual = gcd(4, -2)
     self.assertEqual(expected, actual)
示例#6
0
 def test_gcd_b_greater_than_a(self):
     expected = 2
     actual = gcd(2, 4)
     self.assertEqual(expected, actual)
示例#7
0
 def test_gcd_a_greater_than_b(self):
     expected = 2
     actual = gcd(4, 2)
     self.assertEqual(expected, actual)