diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-06-25 00:07:15 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-06-25 00:07:15 +0900 |
| commit | 2761301dfb6e12fd229f65b49eb28391e49ca671 (patch) | |
| tree | ba79ac33a99e136bfd3ccedaa1928ec38cea416a /test | |
| parent | 2f6eff3821d11608215292792d0879efeeabe2e3 (diff) | |
Rewrite util::divide
Diffstat (limited to 'test')
| -rw-r--r-- | test/UtilTest.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/UtilTest.cc b/test/UtilTest.cc index 39e17a04..c1a0537e 100644 --- a/test/UtilTest.cc +++ b/test/UtilTest.cc @@ -266,33 +266,32 @@ void UtilTest::testLstripIter_char() } void UtilTest::testDivide() { - std::pair<Sip, Sip> p1; std::string s = "name=value"; - util::divide(p1, s.begin(), s.end(), '='); + auto p1 = util::divide(std::begin(s), std::end(s), '='); CPPUNIT_ASSERT_EQUAL(std::string("name"), std::string(p1.first.first, p1.first.second)); CPPUNIT_ASSERT_EQUAL(std::string("value"), std::string(p1.second.first, p1.second.second)); s = " name = value "; - util::divide(p1, s.begin(), s.end(), '='); + p1 = util::divide(std::begin(s), std::end(s), '='); CPPUNIT_ASSERT_EQUAL(std::string("name"), std::string(p1.first.first, p1.first.second)); CPPUNIT_ASSERT_EQUAL(std::string("value"), std::string(p1.second.first, p1.second.second)); s = "=value"; - util::divide(p1, s.begin(), s.end(), '='); + p1 = util::divide(std::begin(s), std::end(s), '='); CPPUNIT_ASSERT_EQUAL(std::string(""), std::string(p1.first.first, p1.first.second)); CPPUNIT_ASSERT_EQUAL(std::string("value"), std::string(p1.second.first, p1.second.second)); s = "name="; - util::divide(p1, s.begin(), s.end(), '='); + p1 = util::divide(std::begin(s), std::end(s), '='); CPPUNIT_ASSERT_EQUAL(std::string("name"), std::string(p1.first.first, p1.first.second)); CPPUNIT_ASSERT_EQUAL(std::string(""), std::string(p1.second.first, p1.second.second)); s = "name"; - util::divide(p1, s.begin(), s.end(), '='); + p1 = util::divide(std::begin(s), std::end(s), '='); CPPUNIT_ASSERT_EQUAL(std::string("name"), std::string(p1.first.first, p1.first.second)); CPPUNIT_ASSERT_EQUAL(std::string(""), |
