Question: In C + + Please Program Objective: You are tasked with creating a test of a dayNumber function. You are not writing the dayNumber function,

In C++ Please
Program Objective:
You are tasked with creating a test of a dayNumber function.
You are not writing the dayNumber function, only coding the test of this function
Read the pre and post conditions for testDayNumber in functions.h
Implement testDayNumber
You may choose to implement dayNumber, however, please do not submit your version of dayNumber
functions.h listed below:
//Precondition: not any
//Postcondition: If the input string date is a non-empty string in the format of m/d/y where m, d, and y where
// non-negative integers the function returns a number from 1 to 366; the number of days from the beginning of the year,
// where January 1st returns 1 and December 31st returns either 365 or 366 depending on the year.
// Returns 0 when the provided input string is not a valid date. By the given format, any year greater than 0 is valid.
unsigned short dayNumber(const char date[]);
//Precondition: not any
//Postconditon: Returns 0 if all test cases for dayNumber passes. Otherwise, returns a number greater than 0, where
// the number correlates to the first test case that failed. This function is NOT chatty.
unsigned short testDayNumber();
Starter Code listed below:
#include "functions.h"
unsigned short testDayNumber(){
if (dayNumber("1/1/1")!=1)//Valid date of January 1st, should return 1, no matter what the year is
return 1;
//TODO: Add more tests
return 0; //All tests passed
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!