Browse Source

find() -> find_if() etc. to make it compile. *sigh*

master
roker 4 months ago
parent
commit
680a19bcc8
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      test/unittest_stringpair.cc

+ 5
- 5
test/unittest_stringpair.cc View File

@ -43,22 +43,22 @@ TEST( StringPair, Dynamic )
EXPECT_EQ(spl.size(), u);
snprintf(key, 15, "k%u", u);
snprintf(value, 15, "v%u", u*91);
spl.push_back( pEp::StringPair{key, value} );
spl.push_back( pEp::StringPair{key, value}.move_out() );
}
auto find_by_key = [key](const pEp::StringPair& sp){ return sp.key == key; };
auto find_by_key = [key](const pEp::StringPair& sp){ return strcmp(sp.get()->key, key)==0; };
// delete random elements.
for(unsigned u=0; u<NumberOfElements; ++u)
{
EXPECT_EQUAL(spl.size(), NumberOfElements-u);
EXPECT_EQ(spl.size(), NumberOfElements-u);
snprintf(key, 15, "k%u", (u*7) % NumberOfElements); // permutate keys order
auto q = std::find( spl.begin(), spl.end(), find_by_key );
auto q = std::find_if( spl.begin(), spl.end(), find_by_key );
EXPECT_NE( q, spl.end() ); // element with key is found
spl.erase(q);
q = std::find( spl.begin(), spl.end(), find_by_key );
q = std::find_if( spl.begin(), spl.end(), find_by_key );
EXPECT_EQ( q, spl.end() ); // element with that key is no longer found
}
}

Loading…
Cancel
Save