Skip to content

Commit

Permalink
stringutils: add test for sortstringbyname
Browse files Browse the repository at this point in the history
  • Loading branch information
Deniz Türkoglu committed Feb 23, 2015
1 parent 583eda7 commit a505e20
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions xbmc/utils/test/TestStringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "utils/StringUtils.h"
#include <algorithm>

#include "gtest/gtest.h"

Expand Down Expand Up @@ -478,3 +479,16 @@ TEST(TestStringUtils, Paramify)
std::string result = StringUtils::Paramify(input);
EXPECT_STREQ(ref, result.c_str());
}

TEST(TestStringUtils, sortstringbyname)
{
std::vector<std::string> strarray;
strarray.push_back("B");
strarray.push_back("c");
strarray.push_back("a");
std::sort(strarray.begin(), strarray.end(), sortstringbyname());

EXPECT_STREQ("a", strarray[0].c_str());
EXPECT_STREQ("B", strarray[1].c_str());
EXPECT_STREQ("c", strarray[2].c_str());
}

0 comments on commit a505e20

Please sign in to comment.