Beispiel #1
0
 def test_eq_deg2_float_False(self):
     # Arrange
     firstPol = Polynome([5])
     secondPol = float(3.1)
     # Act
     eq = firstPol.__eq__(secondPol)
     # Assert
     self.assertFalse(eq)
Beispiel #2
0
 def test_isub_deg2_deg2_2polynome(self):
     # Arrange
     firstPol = Polynome([-3, 2, 5])
     secondPol = Polynome([-1, 5, -2])
     # Act
     firstPol -= secondPol
     # Assert
     self.assertEqual(str(firstPol), '-2x^2 - 3x + 7')
Beispiel #3
0
 def test_ne_deg2_deg2_False(self):
     # Arrange
     firstPol = Polynome([27, -91, -2])
     secondPol = Polynome([27, -91, -2])
     # Act
     eq = firstPol != secondPol
     # Assert
     self.assertFalse(eq)
Beispiel #4
0
 def test_rsub_deg3_deg3_1polynome(self):
     # Arrange
     firstPol = Polynome([-3, -2, -1, 0])
     secondPol = Polynome([-3, -2, -7, -21])
     # Act
     eq = firstPol.__rsub__(secondPol)
     # Assert
     self.assertEqual(str(eq), '-6x - 21')
Beispiel #5
0
 def test_rsub_deg2_deq2_0polynome(self):
     # Arrange
     firstPol = Polynome([27, -5, -2])
     secondPol = Polynome([27, -5, -30])
     # Act
     eq = firstPol.__rsub__(secondPol)
     # Assert
     self.assertEqual(str(eq), '-28')
Beispiel #6
0
 def test_sub_deg2_deg2_zero_polynome(self):
     # Arrange
     firstPol = Polynome([-2, -1, -2])
     secondPol = Polynome([-2, -1, -2])
     # Act
     eq = firstPol - secondPol
     # Assert
     self.assertEqual(str(eq), '0')
Beispiel #7
0
 def test_rsub_deg2_deg2_2polynome(self):
     # Arrange
     firstPol = Polynome([-3, 2, 5])
     secondPol = Polynome([-1, 5, -2])
     # Act
     eq = firstPol.__rsub__(secondPol)
     # Assert
     self.assertEqual(str(eq), '2x^2 + 3x - 7')
Beispiel #8
0
 def test_imul_deg2_deg_0_2polenome(self):
     # Arrange
     firstPol = Polynome([2, 1, 4])
     secondPol = Polynome([2])
     # Act
     firstPol *= secondPol
     # Assert
     self.assertEqual(str(firstPol), '4x^2 + 2x + 8')
Beispiel #9
0
 def test_add_deg0_deq0_zero_polynome(self):
     # Arrange
     firstPol = Polynome([0])
     second = Polynome([0])
     # Act
     eq = firstPol + second
     # Assert
     self.assertEqual(str(eq), '0')
Beispiel #10
0
 def test_mul_deg2_deg_2_4polenome(self):
     # Arrange
     firstPol = Polynome([2, 2, 4])
     secondPol = Polynome([2, 1, 1])
     # Act
     eq = firstPol * secondPol
     # Assert
     self.assertEqual(str(eq), '4x^4 + 6x^3 + 12x^2 + 6x + 4')
Beispiel #11
0
 def test_mul_deg2_deg_zero_zero_polenome(self):
     # Arrange
     firstPol = Polynome([2, 2, 4])
     second = Polynome([0])
     # Act
     eq = firstPol * second
     # Assert
     self.assertEqual(str(eq), '0')
Beispiel #12
0
 def test_mul_deg2_deg_1_3polenome(self):
     # Arrange
     firstPol = Polynome([2, 1, 4])
     second = Polynome([2, 0])
     # Act
     eq = firstPol * second
     # Assert
     self.assertEqual(str(eq), '4x^3 + 2x^2 + 8x')
Beispiel #13
0
 def test_ge_deg2_deg2_True(self):
     # Arrange
     firstPol = Polynome([3, 2, -1])
     secondPol = Polynome([2, -1])
     # Act
     eq = firstPol >= secondPol
     # Assert
     self.assertTrue(eq)
Beispiel #14
0
 def test_gt_deg2_deg2_False(self):
     # Arrange
     firstPol = Polynome([3, 2, -1])
     secondPol = Polynome([2, -1])
     # Act
     eq = secondPol > firstPol
     # Assert
     self.assertFalse(eq)
Beispiel #15
0
 def test_sub_deg2_deg2_1polynome(self):
     # Arrange
     firstPol = Polynome([-3, -2, -1])
     secondPol = Polynome([-8, -2, -3])
     # Act
     eq = firstPol - secondPol
     # Assert
     self.assertEqual(str(eq), '5x^2 + 2')
Beispiel #16
0
 def test_radd_deg2_deg2_2polynome(self):
     # Arrange
     firstPol = Polynome([-3, -2, -1])
     secondPol = Polynome([18, 15, -2])
     # Act
     eq = firstPol .__radd__(secondPol)
     # Assert
     self.assertEqual(str(eq), '15x^2 + 13x - 3')
Beispiel #17
0
 def test_sub_deg3_deg3_1polynome(self):
     # Arrange
     firstPol = Polynome([-3, -2, -1, 0])
     secondPol = Polynome([-3, -2, -7, -21])
     # Act
     eq = firstPol - secondPol
     # Assert
     self.assertEqual(str(eq), '6x + 21')
Beispiel #18
0
 def test_radd_deg2_deg2_1polynome(self):
     # Arrange
     firstPol = Polynome([-3, -2, -1])
     secondPol = Polynome([8, 2, -8])
     # Act
     eq = firstPol.__radd__(secondPol)
     # Assert
     self.assertEqual(str(eq), '5x^2 - 9')
Beispiel #19
0
 def test_sub_deg2_deq0_2polynome(self):
     # Arrange
     firstPol = Polynome([28, 71, -2])
     secondPol = Polynome([0])
     # Act
     eq = firstPol - secondPol
     # Assert
     self.assertEqual(str(eq), '28x^2 + 71x - 2')
Beispiel #20
0
 def test_radd_deg3_deg3_1polynome(self):
     # Arrange
     firstPol = Polynome([-6, -8, -1, 0])
     secondPol = Polynome([6, 8, 8, 7])
     # Act
     eq = firstPol.__radd__(secondPol)
     # Assert
     self.assertEqual(str(eq), '7x + 7')
Beispiel #21
0
 def test_rsub_deg2_deg2_1polynome(self):
     # Arrange
     firstPol = Polynome([-3, -2, -1])
     secondPol = Polynome([-8, -2, -3])
     # Act
     eq = firstPol.__rsub__(secondPol)
     # Assert
     self.assertEqual(str(eq), '-5x^2 - 2')
Beispiel #22
0
 def test_radd_deg2_deg2_zero_polynome(self):
     # Arrange
     firstPol = Polynome([-112, -771, -892])
     secondPol = Polynome([112, 771, 892])
     # Act
     eq = firstPol.__radd__(secondPol)
     # Assert
     self.assertEqual(str(eq), '0')
Beispiel #23
0
 def test_rsub_deg2_deq0_2polynome(self):
     # Arrange
     firstPol = Polynome([28, 71, -2])
     secondPol = Polynome([0])
     # Act
     eq = firstPol.__rsub__(secondPol)
     # Assert
     self.assertEqual(str(eq), '-28x^2 - 71x + 2')
Beispiel #24
0
 def test_radd_deg2_deq0_2polynome(self):
     # Arrange
     firstPol = Polynome([2, 100, -25])
     second = Polynome([0])
     # Act
     eq = firstPol.__radd__(second)
     # Assert
     self.assertEqual(str(eq), '2x^2 + 100x - 25')
Beispiel #25
0
 def test_rsub_deg0_deq0_zero_polynome(self):
     # Arrange
     firstPol = Polynome([0])
     secondPol = Polynome([0])
     # Act
     eq = firstPol.__rsub__(secondPol)
     # Assert
     self.assertEqual(str(eq), '0')
Beispiel #26
0
 def test_radd_deg2_deq2_0polynome(self):
     # Arrange
     firstPol = Polynome([22, 14, -20])
     secondPol = Polynome([-22, -14, 30])
     # Act
     eq = firstPol.__radd__(secondPol)
     # Assert
     self.assertEqual(str(eq), '10')
Beispiel #27
0
 def test_ne_deg2_deg2_True(self):
     # Arrange
     firstPol = Polynome([72, 18, -2])
     secondPol = Polynome([72, 52, -2])
     # Act
     eq = firstPol != secondPol
     # Assert
     self.assertTrue(eq)
Beispiel #28
0
 def test_iadd_deg2_deg2_2polynome(self):
     # Arrange
     firstPol = Polynome([-3, -2, -1])
     secondPol = Polynome([18, 15, -2])
     # Act
     firstPol += secondPol
     # Assert
     self.assertEqual(str(firstPol), '15x^2 + 13x - 3')
Beispiel #29
0
 def test_eq_deg2_deg2_True(self):
     # Arrange
     firstPol = Polynome([9, 1, -9])
     secondPol = Polynome([9, 1, -9])
     # Act
     eq = firstPol.__eq__(secondPol)
     # Assert
     self.assertTrue(eq)
Beispiel #30
0
 def test_eq_deg2_float_True(self):
     # Arrange
     firstPol = Polynome([4.8])
     secondPol = float(4.8)
     # Act
     eq = firstPol.__eq__(secondPol)
     # Assert
     self.assertTrue(eq)