QuestionQ225

VerifiedDebugging and Deploying

You are testing a set of mathematical functions, including one that calculates the area beneath a curve defined by another function.

assert(myIntegrate(lambda x: x*x, 0, 3) [0] == 9)

What type of test does the preceding line exemplify?

Explanation

A unit test verifies an individual unit of code, such as a function, by supplying known inputs and asserting the expected output. The assertion checks that integrating x² from 0 to 3 returns 9.

Community Discussion

No comments yet. Be the first to start the discussion!