MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / TEST

Function TEST

src/Utils/StringUtils_test.cpp:31–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30namespace {
31TEST(StringUtilsTest, Tokenize) {
32 std::vector<std::string_view> tok_result;
33 StringUtils::tokenize("A;tokenized. string,List", ",.;", tok_result);
34 EXPECT_EQ(tok_result.size(), size_t(4));
35 EXPECT_THAT(tok_result, ElementsAre("A", "tokenized", " string", "List"));
36
37 // Terminating separator should include an emty string
38 tok_result.clear();
39 StringUtils::tokenize("A;tokenized. string,List;", ",.;", tok_result);
40 EXPECT_EQ(tok_result.size(), size_t(5));
41 EXPECT_THAT(tok_result, ElementsAre("A", "tokenized", " string", "List", ""));
42
43 // Consecutive separators should include empty strings
44 tok_result.clear();
45 StringUtils::tokenize("A;tokenized. string,,List", ",.;", tok_result);
46 EXPECT_EQ(tok_result.size(), size_t(5));
47 EXPECT_THAT(tok_result, ElementsAre("A", "tokenized", " string", "", "List"));
48}
49
50TEST(StringUtilsTest, TokenizeMulti) {
51 std::vector<std::string_view> tok_result;

Callers

nothing calls this directly

Calls 3

StrCatFunction · 0.85
StrAppendFunction · 0.85
clearMethod · 0.80

Tested by

no test coverage detected