mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
Add one more case ( "=" ) and test get_str_vec as well.
Signed-off-by: Yann Dupont <yann@objoo.org>
This commit is contained in:
parent
5b8c705fc3
commit
ca10ce4f5d
@ -3,6 +3,7 @@
|
||||
#include "include/str_list.h"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
@ -19,10 +20,11 @@ const char *tests[][10] = {
|
||||
{ " a\tb\tc\t", "a", "b", "c", 0 },
|
||||
{ "a, b, c", "a", "b", "c", 0 },
|
||||
{ "a b c", "a", "b", "c", 0 },
|
||||
{ "a=b=c", "a", "b", "c", 0 },
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
TEST(StrList, All)
|
||||
TEST(StrList, get_str_list)
|
||||
{
|
||||
for (unsigned i=0; tests[i][0]; ++i) {
|
||||
std::string src = tests[i][0];
|
||||
@ -35,3 +37,18 @@ TEST(StrList, All)
|
||||
ASSERT_EQ(actual, expected);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(StrList, get_str_vec)
|
||||
{
|
||||
for (unsigned i=0; tests[i][0]; ++i) {
|
||||
std::string src = tests[i][0];
|
||||
std::vector<std::string> expected;
|
||||
for (unsigned j=1; tests[i][j]; ++j)
|
||||
expected.push_back(tests[i][j]);
|
||||
std::vector<std::string> actual;
|
||||
get_str_vec (src, actual);
|
||||
std::cout << "'" << src << "' -> " << actual << std::endl;
|
||||
ASSERT_EQ(actual, expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user