From: Yann Dupont Date: Sun, 28 Sep 2014 22:14:45 +0000 (+0200) Subject: Add one more case ( "=" ) and test get_str_vec as well. X-Git-Tag: v0.88~114^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ca10ce4f5ddcc42761a78920924ebb6edbaa71fb;p=ceph.git Add one more case ( "=" ) and test get_str_vec as well. Signed-off-by: Yann Dupont --- diff --git a/src/test/test_str_list.cc b/src/test/test_str_list.cc index 7b92e5181bf0..30a3937c8ad9 100644 --- a/src/test/test_str_list.cc +++ b/src/test/test_str_list.cc @@ -3,6 +3,7 @@ #include "include/str_list.h" #include +#include #include #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 expected; + for (unsigned j=1; tests[i][j]; ++j) + expected.push_back(tests[i][j]); + std::vector actual; + get_str_vec (src, actual); + std::cout << "'" << src << "' -> " << actual << std::endl; + ASSERT_EQ(actual, expected); + } + +}