add coverage
This commit is contained in:
24
tests/string_helper_tests.cpp
Normal file
24
tests/string_helper_tests.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "helpers/string.hpp"
|
||||
|
||||
TEST_CASE("StringHelper::split by char", "[string]") {
|
||||
const auto tokens = StringHelper::split("a,b,,c", ',');
|
||||
REQUIRE(tokens.size() == 3);
|
||||
REQUIRE(tokens[0] == "a");
|
||||
REQUIRE(tokens[1] == "b");
|
||||
REQUIRE(tokens[2] == "c");
|
||||
}
|
||||
|
||||
TEST_CASE("StringHelper::split by string", "[string]") {
|
||||
const auto tokens = StringHelper::split("one::two::three", "::");
|
||||
REQUIRE(tokens.size() == 3);
|
||||
REQUIRE(tokens[0] == "one");
|
||||
REQUIRE(tokens[1] == "two");
|
||||
REQUIRE(tokens[2] == "three");
|
||||
}
|
||||
|
||||
TEST_CASE("StringHelper::trimToSize", "[string]") {
|
||||
REQUIRE(StringHelper::trimToSize("hello", 10) == "hello");
|
||||
REQUIRE(StringHelper::trimToSize("hello world", 5) == "hello...");
|
||||
}
|
||||
Reference in New Issue
Block a user