Skip to content

Commit

Permalink
Add tests for the new helper function EndsWith() introduced in PR #1211
Browse files Browse the repository at this point in the history
  • Loading branch information
pnorbert committed Feb 25, 2019
1 parent 0e3695f commit dbdc04c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions testing/adios2/helper/TestHelperStrings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,36 @@ TEST(ADIOS2HelperString, ADIOS2HelperStringAddExtension)
ASSERT_EQ(adios2::helper::AddExtension(abcbp, ext), abcbp);
}

TEST(ADIOS2HelperString, ADIOS2HelperStringEndsWithCaseSensitive)
{

const std::string abcdefgh("abcd.efgh");
const std::string theend(".efgh");
const std::string notanend(".ephs");
const std::string shortstr("abc");

ASSERT_TRUE(adios2::helper::EndsWith(abcdefgh, theend));
ASSERT_FALSE(adios2::helper::EndsWith(abcdefgh, notanend));
ASSERT_FALSE(adios2::helper::EndsWith(shortstr, theend));
}

TEST(ADIOS2HelperString, ADIOS2HelperStringEndsWithCaseInsensitive)
{

const std::string abcdefgh("abCd.eFgH");
const std::string end1(".efGh");
const std::string end2(".efgh");
const std::string noend1(".ephs");
const std::string noend2(".efdHs");
const std::string shortstr("ABC");

ASSERT_TRUE(adios2::helper::EndsWith(abcdefgh, end1, false));
ASSERT_TRUE(adios2::helper::EndsWith(abcdefgh, end2, false));
ASSERT_FALSE(adios2::helper::EndsWith(abcdefgh, noend1, false));
ASSERT_FALSE(adios2::helper::EndsWith(abcdefgh, noend2, false));
ASSERT_FALSE(adios2::helper::EndsWith(shortstr, end1, false));
}

TEST(ADIOS2HelperString, ADIOS2HelperStringConversion)
{

Expand Down

0 comments on commit dbdc04c

Please sign in to comment.