Consider the following class definition:
class StrToTokens {
StrToTokens(const char* str, const char* delimiters = "\t\r\n"); //constructor
string getNextToken();
void reset();
bool empty();
}
Can someone list some good testcases to test the above class.
A few I could think of are:
empty string, empty delimiters, repeated delimiters, consecutive delimiters, string with only delimiters.
However, the interviewer expected some more(better ones). Can you help out.
Thanks.
Well, I usually add at least one testcase that just tests for a normal working case. And of course all the tests you guys mentioned where just for the constructor. The other methods have to be tested as well:
I usually implement some more complex testcases to test such things, such as
Or