Google Testing CopyCode
I'm writing a Google test for an implementation of a Map class but I can't get the output I'm looking for out of it.
1 2 3 4 5 6 7 8 9 10 11
|
TEST(MapTest, eraseOfExistingKeyReturnsTrueAndDecrementsSize)
{
Map testMap;
testMap.insert( "one", "un" );
testMap.insert( "two", "deux" );
EXPECT_EQ( testMap.size() , 2 );
EXPECT_EQ( testMap.erase( "two" ), true );
EXPECT_EQ( testMap.size() , 1 );
EXPECT_EQ( testMap.erase( "one" ), true );
EXPECT_EQ( testMap.size() , 0 );
}
|
This isn't catching all errors. how can I make it more throughout?
So far you have tested the insert and erase functions.
You also should test the constructors and find functions.
What output do you expect ?
Topic archived. No new replies allowed.