Electrical and Computer Engineering
23 of 24
UAH
CPE 112
Testing & Debugging – Stubs
•A stub is has the same name and interface as a function that actually would be called by the part of the program being tested, but it is usually much simpler
•Example
–void GetYear (/*inout*/ ifstream& dataIn,   // Input file
–              /*out*/ string& year)  //Four digits of year
–
–// Stub for GetYear function in the ConvertDates program
–
–{
– cout << “Get Year was called here. Returning \”1949\”.”
–      << endl;
– year = “1948”;
–}