Question: Please provide code for a unit test program to test the following functions: def addition(x, y): return x + y def subtraction(x, y): return x

Please provide code for a unit test program to test the following functions:

def addition(x, y):

return x + y

def subtraction(x, y):

return x - y

def multiplication(x, y):

return x * y

def division(x, y):

return x / y

 

For each function, should test:

  1. When given two positive numbers, whether the function returns correct value
  2. When given negative numbers, whether the function returns correct value
  3. When given one positive number and one negative number , whether the function returns correct value

Step by Step Solution

3.48 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres an example of a unit test program using Pythons builtin unittest framework to test the additio... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!