In TODO 2, you are going to write automatic tests for the is_prime function by completing the
Fantastic news! We've Found the answer you've been seeking!
Question:
- In TODO 2, you are going to write automatic tests for the is_prime function by completing the body of the test_is_prime function. The is_prime function expects an integer greater than 0 as an argument. It outputs a boolean encoding whether the number is prime or not. A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1, involve 5 itself.
- Your task is to use several assert statements (within the test_is_prime function) with calls to the is_prime function using different arguments. The test_is_prime function can then be used to ascertain that the is_prime function returns the expected results. Note that you are required to implement at least 5 additional assert statements (there will be 6 in total).
- Choose the tests so that a correct implementation of the is_prime function passes but an incorrect implementation fails.
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date: