Correct expected value

Report a typo

Suppose you have a unit which calculates the value of the quadratic function below:

y = x^2 + 2x + 1

This is the unit test for the function:

x = 2
expected = ?

output = f(x)

if expected == output:
   print("Passed")
else:
   print("Failed")

What expected value is assumed for "Passed" test result?

Enter a number
___

Create a free account to access the full topic