Beispiel #1
0
 def test_mul_frac(self):
     self.assertIs(fracs.cmp_frac(fracs.mul_frac([1, 1], [1, 1]), [1, 1]),
                   0)
     self.assertIs(fracs.cmp_frac(fracs.mul_frac([1, 2], [1, 2]), [1, 4]),
                   0)
     self.assertIs(fracs.cmp_frac(fracs.mul_frac([1, 2], [1, -2]), [1, -4]),
                   0)
Beispiel #2
0
 def test_add_frac(self):
     self.assertIs(fracs.cmp_frac(fracs.add_frac([1, 1], [1, 1]), [2, 1]),
                   0)
     self.assertIs(fracs.cmp_frac(fracs.add_frac([1, 2], [1, -2]), [0, 1]),
                   0)
     self.assertIs(fracs.cmp_frac(fracs.add_frac([1, 2], [1, 3]), [5, 6]),
                   0)
Beispiel #3
0
 def test_div_frac(self):
     self.assertIs(fracs.cmp_frac(fracs.div_frac([1, 1], [1, 1]), [1, 1]),
                   0)
     self.assertIs(fracs.cmp_frac(fracs.div_frac([1, 2], [1, 2]), [1, 1]),
                   0)
     self.assertIs(fracs.cmp_frac(fracs.div_frac([1, 2], [1, -2]), [-1, 1]),
                   0)
Beispiel #4
0
 def test_sub_frac(self):
     self.assertIs(fracs.cmp_frac(fracs.sub_frac([1, 1], [1, 1]), [0, 1]),
                   0)
     self.assertIs(fracs.cmp_frac(fracs.sub_frac([1, 2], [1, -2]), [1, 1]),
                   0)
     self.assertIs(fracs.cmp_frac(fracs.sub_frac([1, 2], [1, 2]), [0, 1]),
                   0)
Beispiel #5
0
 def test_cmp_frac(self):
     self.assertEqual(fracs.cmp_frac([1, 2], [1, 3]), -1)
     self.assertEqual(fracs.cmp_frac([1, 3], [1, 2]), 1)
     self.assertEqual(fracs.cmp_frac([1, 3], [1, 3]), 0)
     self.assertEqual(fracs.cmp_frac([1, 2], [-1, 3]), -1)
     self.assertEqual(fracs.cmp_frac([-1, 2], [1, 3]), 1)
     self.assertEqual(fracs.cmp_frac([0, 2], [1, 3]), 1)
     self.assertEqual(fracs.cmp_frac([0, 2], [-1, 3]), -1)
Beispiel #6
0
 def test_cmp_frac(self):
     self.assertIs(fracs.cmp_frac([1, 2], [2, 4]), 0)
     self.assertIs(fracs.cmp_frac([0, 2], [1, 1]), -1)
     self.assertIs(fracs.cmp_frac([4, 2], [1, 2]), 1)
Beispiel #7
0
 def test_cmp_frac(self):
     self.assertEqual(fracs.cmp_frac([3, 2], [-4, 3]), 1)
     self.assertEqual(fracs.cmp_frac([2, 3], [3, 4]), -1)
     self.assertEqual(fracs.cmp_frac([2, 3], [4, 6]), 0)
Beispiel #8
0
 def test_cmp_frac(self):
     self.assertEqual(fracs.cmp_frac(f1, f3), 1)
     self.assertEqual(fracs.cmp_frac(f4, f5), -1)
     self.assertEqual(fracs.cmp_frac(f4, f3), 0)
Beispiel #9
0
 def test_cmp_frac(self):
     self.assertEqual(fracs.cmp_frac([2, 3], [1, 4]), 1)
Beispiel #10
0
 def test_cmp_frac(self):
     self.assertEqual(fracs.cmp_frac(self.pierwszy, self.drugi), -1)
Beispiel #11
0
 def test_cmp_frac(self):
     self.assertEqual(fracs.cmp_frac([1, 2], [1, 3]), 1)