hack/tests/string.cpp
2022-08-15 21:02:19 +03:00

23 lines
491 B
C++

#include <gtest/gtest.h>
#include <string>
#include <vector>
#include "string/string.hpp"
TEST(split_str, check)
{
std::vector<std::string> v { "asdf", "qwer", "zxcv" };
ASSERT_EQ(hack::string::split_str("asdf,qwer,zxcv", ','), v);
std::vector<std::string> v1 { "qqq", "aaa", "eee", "sss" };
ASSERT_EQ(hack::string::split_str("qqq,aaa:eee,sss", ":,"), v1);
}
TEST(split_stoi, check)
{
std::vector<int> v { 1, 2, 3 };
ASSERT_EQ(hack::string::split_stoi("1 2 3", ' '), v);
}