diff options
Diffstat (limited to 'base/strings_test.cpp')
-rw-r--r-- | base/strings_test.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/base/strings_test.cpp b/base/strings_test.cpp index 46a1ab543..5f675750c 100644 --- a/base/strings_test.cpp +++ b/base/strings_test.cpp @@ -20,6 +20,8 @@ #include <string> #include <vector> +#include <set> +#include <unordered_set> TEST(strings, split_empty) { std::vector<std::string> parts = android::base::Split("", ","); @@ -121,6 +123,17 @@ TEST(strings, join_separator_in_vector) { ASSERT_EQ(",,,", android::base::Join(list, ',')); } +TEST(strings, join_simple_ints) { + std::set<int> list = {1, 2, 3}; + ASSERT_EQ("1,2,3", android::base::Join(list, ',')); +} + +TEST(strings, join_unordered_set) { + std::unordered_set<int> list = {1, 2}; + ASSERT_TRUE("1,2" == android::base::Join(list, ',') || + "2,1" == android::base::Join(list, ',')); +} + TEST(strings, startswith_empty) { ASSERT_FALSE(android::base::StartsWith("", "foo")); ASSERT_TRUE(android::base::StartsWith("", "")); |