# Functino that will be tested
def add(a, b):
return a + b
# Creating a testing function
def test_add_function():
# Test 1: Positive numbers
result = add(2, 3)
#intenionally wrong expected answer to test if checking correct vs incorrect is working
expected = 12
#Checking to see if output is correct
if result == expected:
#Prints out if actual output matches the expected output
print("Test 1 passed")
else:
#Prints out if actual ouput does not match the expected output
print(f"Test 1 failed. Should be {expected}, but got {result}")
# Test 2: Negative numbers
result = add(-2, -3)
expected = -5
#Check to see if output is correct
if result == expected:
print("Test 2 passed")
else:
print(f"Test 2 failed. Should be {expected}, but got {result}")
# Test 3: Mixed numbers
result = add(5, -3)
expected = 2
#Check to see if output is correct
if result == expected:
print("Test 3 passed")
else:
print(f"Test 3 failed. Should be {expected}, but got {result}")
# Running the overall function
test_add_function()
Test 1 failed. Should be 12, but got 5
Test 2 passed
Test 3 passed
You are not entering numbers