Merge pull request #2 from red0124/testing

Testing
This commit is contained in:
red0124 2021-01-07 23:16:34 +01:00 committed by GitHub
commit cf5ed7cf9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 11 deletions

View File

@ -4,6 +4,7 @@ on:
push:
branches:
- master
- testing
pull_request:
branches:

View File

@ -1,19 +1,17 @@
#include <ss/converter.hpp>
#include <doctest/doctest.h>
#include <algorithm>
#include <doctest/doctest.h>
#include <ss/converter.hpp>
TEST_CASE("testing split") {
ss::converter c;
for (const auto& [s, expected, delim] :
// clang-format off
{std::tuple{"a,b,c,d", std::vector{"a", "b", "c", "d"}, ","},
{"", {}, " "},
{"a,b,c", {"a", "b", "c"}, ""},
{" x x x x | x ", {" x x x x ", " x "}, "|"},
{"a::b::c::d", {"a", "b", "c", "d"}, "::"},
{"x\t-\ty", {"x", "y"}, "\t-\t"},
{"x", {"x"}, ","}} // clang-format on
) {
{std::make_tuple("a,b,c,d", std::vector{"a", "b", "c", "d"}, ","),
{"", {}, " "},
{"a,b,c", {"a", "b", "c"}, ""},
{" x x x x | x ", {" x x x x ", " x "}, "|"},
{"a::b::c::d", {"a", "b", "c", "d"}, "::"},
{"x\t-\ty", {"x", "y"}, "\t-\t"},
{"x", {"x"}, ","}}) {
auto split = c.split(s, delim);
CHECK(split.size() == expected.size());
for (size_t i = 0; i < split.size(); ++i) {