Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create unit tests for functions using CppUnitTest, Execute the tests under Visual Studio. Instructions You will create code to store information on a customer including:

Create unit tests for functions using CppUnitTest,
Execute the tests under Visual Studio.
Instructions
You will create code to store information on a customer including:
The customers 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 4x4
You entered:
John Smith
35 Elm St.,
Toronto, ON,
M2E 4X4
Once 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

Define Management by exception

Answered: 1 week ago

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago

Question

Explain the process of MBO

Answered: 1 week ago