I use Parasoft's C ++ Test for unit testing C ++ code. I ran into the following problem. I have a function similar to the following (pseudocode):
bool LoadFileToMem(const std::string& rStrFileName)
{
if( openfile(rStrFileName) == successfull )
{
if( get_file_size() == successfull )
{
if( read_entire_file_to_buffer() == successfull )
{
return true;
}
return false;
}
return false;
}
return false;
}
My questions in this case are:
Should I use stubs for file system functions? Or should I include specific test files for unit test testing?
In my case, std :: fstream is used to enter the file .
Are there any better deals? (Best if done in C ++ Test, but not required).
source
share