• Create unit tests for functions using CppUnitTest,
• Execute the tests under Visual Studio.You will create code to store information on a customer including:
• The customer’s first and last name,
• The customer street address,
• The customer city,
• The customer province,
• The customer postal code.You should:
• Create a structure to store the information on the customer,
• Create a function to prompt the user to enter the customer information on the command line
and store it in the structure. This function will ensure that every field has a value and that the
postal code is valid. If any are not valid, it will prompt the user until a valid value is entered. This
function will return a structure that is guaranteed to have values in each field and have a valid
postal code.• Create a function to test the validity of the postal code and return a Boolean true if the code is
valid and a Boolean false if the code is invalid. It should accept postal code in upper or lower
case and translate them all to upper case. It should also accept them with no spaces or several
spaces between the groups of 3 characters. It will return the postal code in uppercase with one
space between the groups of 3 characters.• Create a main that invokes the function to get the data into the structure and then prints out
the contents of the structure.NOTE that the function fgets() used with the stdin stream will read a string until end of line and add a
at the end of the string. This will reliably determine if an empty string was entered.A typical use of the function to read customer data is:
Enter your first name: John
Enter your last name:
Invalid Entry: Enter your last name: Smith
Enter your street address: 25 Elm St.
Enter your city: Toronto
Enter your province: ON
Enter your postal code:m2e44x
Invalid Entry: Enter your postal code: m2e 4×4
You entered:
John Smith
35 Elm St.,
Toronto, ON,
M2E 4X4Once you complete the two (or more) functions and the main program, you should create a test project
in the same Visual Studio solution. Then design and build unit tests for the two functions you created.
You should include both black box and white box unit tests. Comment each test so that the instructor
knows what you are testing. Be sure to use appropriate test data.Deliverables
Due Date:
This workshop is due 2 days after your lab day. Late workshops will not be accepted.You should submit:
• A zipped Visual Studio project that contains the code to be tested and the test suite for the code
that proves the code works.A Reflection, Research and Assessment
Reflections should consider the questions in depth and not be trivial. Some reflections might require
research to properly answer the question. As a rough guideline, the answer to each reflection questions
should be about 100 words in length.• How did you test the function to gather customer information to ensure that blank lines were
not entered? Testing that the correct prompts were issued for blank lines is beyond the scope of
this workshop, however how could you test that the correct prompts were produced by the
program if you had to?Marking Rubric
Comprehensiveness of black box test cases 20%
Comprehensiveness of white box test cases 10%
C project compiles and works 10%
C++ project compiles and works 20%
C++ project test results are valid 20%
Reflection 20%
3, SFT221, solved, Workshop, –
[SOLVED] Sft221 – workshop 3
$25
File Name: Sft221_–_workshop_3.zip
File Size: 197.82 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.