Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python code: Using the Python unittest module!!! How do you write black box tests for verifing if a number is within a certain range? For
Python code: Using the Python unittest module!!!
How do you write black box tests for verifing if a number is within a certain range?
For example, how would you write a test to verify if the first two digits of a credit card number (entered as a string of numbers) are within the range of 51 - 55?
And how would you verify with a test that the first two digits in a string of numbers is 34 or 37?
And how would you write a test to verify that the last digit of the credit card is the correct check digit?
The last digit of the number is referred to as the check digit and acts as a checksum. Most credit cards calculate this check digit using the Luhn algorithm (see resources below for how this is calculated). In order to limit the scope of this assignment, we are going to limit the number of credit card issuers to 3: Visa, MasterCard, and American Express. Each has its own prefixes and length requirements. - Visa Prefix(es): 4 - Length: 16 - MasterCard Prefix(es): 51 through 55 and 2221 through 2720 Length: 16 - American Express Prefix(es): 34 and 37 - Length: 15Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started