written some tests based on a non-working feature (operator[] =
operator[])
This commit is contained in:
parent
bdfc14357a
commit
da378efaaa
@ -86,6 +86,11 @@ int main()
|
||||
if (str[1] == 'i')
|
||||
std::cout << "String::operator[] works" << std::endl;
|
||||
|
||||
String sajtok = "sajtok";
|
||||
sajtok[5] = sajtok[0];
|
||||
if (!std::strcmp(sajtok.c_str(), "sajtos"))
|
||||
std::cout << "String::operator[]'s operator= works with other String::operator[]s" << std::endl;
|
||||
|
||||
try { str[8]; }
|
||||
catch (std::out_of_range)
|
||||
{ std::cout << "String::operator[] throws when index is out of range" << std::endl; }
|
||||
|
10
test.cpp
10
test.cpp
@ -173,7 +173,15 @@ TEST(StringTest, indexOperatorWorks)
|
||||
EXPECT_EQ(i, str[1]);
|
||||
}
|
||||
|
||||
TEST(StringTest, indexoperatorBoundCheckWorks)
|
||||
TEST(StringTest, indexOperatorWorksWhenUsedWithOtherIndexOperators)
|
||||
{
|
||||
String sajtok = "sajtok";
|
||||
sajtok[5] = sajtok[0];
|
||||
|
||||
EXPECT_STREQ("sajtos", sajtok.c_str());
|
||||
}
|
||||
|
||||
TEST(StringTest, indexOperatorBoundCheckWorks)
|
||||
{
|
||||
String str("sajt");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user