def test_add(self):
        result = calc.add(0,0)
        self.assertEqual(result, 0)

        result = calc.add(-1,-1)
        self.assertEqual(result, -2)

        result = calc.add(5, 4)
        self.assertEqual(result, 9)
    def test_add_of_many(self):
        result = calc.add(1, 2, 3)
        self.assertEqual(result, 6)

        result = calc.add(1, -2, 3)
        self.assertEqual(result, 2)

        result = calc.add(-1, -2, -3)
        self.assertEqual(result, -6)

        result = calc.add(1, 2, 3, 4)
        self.assertEqual(result, 10)
Пример #3
0
def test_add():
    assert calculator.add(0, 0) == 0
    assert calculator.add(-1, -1) == -2
    assert calculator.add(4, 5) == 9
    assert calculator.add(1, 2, 3, 4) == 10
def test_add_different_numbers():
    assert add(4,5) == 9
def test_add_negative_numbers():
    assert add(-1,-1) == -2
def test_add():
    assert add(0,0) == 0
def test_add_multiple_numbers():
    assert add(1,2,3,4) == 10    
def test_add_many_numbers():
	"""it can add many numbers"""
	assert simple_calculator.add(10, 20, 30) == 60
	assert simple_calculator.add(-20, 10) == -10
def test_add_two_numbers():
	"""it can add 2 numbers"""
	assert simple_calculator.add(0, 0) == 0
	assert simple_calculator.add(-1, -1) == -2
	assert simple_calculator.add(4, 5) == 9
Пример #10
0
def test_add():
    assert simple_calculator.add(0, 0) == 0
    assert simple_calculator.add(-1, -1) == -2
    assert simple_calculator.add(4, 5) == 9
    assert simple_calculator.add(1, 2, 3) == 6
 def test_add(self):
     self.assertEqual(simple_calculator.add(6, 9), 15)
     self.assertEqual(simple_calculator.add(3.6, 2), 5.6)
     self.assertEqual(round(simple_calculator.add(-4.20, 13.37), 2), 9.17)
Пример #12
0
 def test_add(self):
     self.assertEqual(simple_calculator.add(2,2),4)
     self.assertEqual(simple_calculator.add(2,-2),0)
def test_add():
    result = add(0, 0)
    assert result == 0
def test_add():
    result = add(1, 2, 3, 4)
    assert result == 10
def test_add():
    result = add(4, 5)
    assert result == 9
def test_add():
    result = add(-1, -1)
    assert result == -2