hack/tests/string.cpp

22 lines
495 B
C++
Raw Normal View History

2022-02-28 12:44:18 +03:00
#include <gtest/gtest.h>
#include <string>
#include <vector>
2023-05-23 12:13:38 +03:00
#include "hack/string/string.hpp"
2022-02-28 12:44:18 +03:00
2022-03-01 12:03:12 +03:00
TEST(split_str, check)
2022-02-28 12:44:18 +03:00
{
2022-03-02 12:11:21 +03:00
std::vector<std::string> v { "asdf", "qwer", "zxcv" };
ASSERT_EQ(hack::string::split_str("asdf,qwer,zxcv", ','), v);
2022-07-20 11:13:55 +03:00
std::vector<std::string> v1 { "qqq", "aaa", "eee", "sss" };
ASSERT_EQ(hack::string::split_str("qqq,aaa:eee,sss", ":,"), v1);
2022-02-28 12:44:18 +03:00
}
2022-08-15 21:02:19 +03:00
TEST(split_stoi, check)
{
std::vector<int> v { 1, 2, 3 };
ASSERT_EQ(hack::string::split_stoi("1 2 3", ' '), v);
}