Skip to content

Commit

Permalink
Add tokenize test
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 8d12af5b0a85d52abea2cad51a9cff87e8d4ee7b
  • Loading branch information
Vertexwahn committed Aug 14, 2024
1 parent eed551f commit 2306959
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions devertexwahn/flatland/rendering/scene/load_scene_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,23 @@ namespace de_vertexwahn {
Point3f convert_csv_to_point3f(const std::string& csv);
template <>
Transform44f read_transform<3>(const pugi::xml_node &xmlTransform);
std::vector<std::string> tokenize(const std::string &string,
const std::string &delim = ", ",
bool include_empty = false);
}

using namespace de_vertexwahn;

TEST(tokenize, TokenizeTrivialList) {
std::string input = "1, 2, 3";
auto tokens = tokenize(input);

EXPECT_THAT(tokens.size(), 3u);
EXPECT_THAT(tokens[0], "1");
EXPECT_THAT(tokens[1], "2");
EXPECT_THAT(tokens[2], "3");
}

TEST(load_scene, convert_csv_to_vector2f) {
std::string input = "2.3, 3.4";
Vector2f v = convert_csv_to_vector2f(input);
Expand Down

0 comments on commit 2306959

Please sign in to comment.