Files
devilutionX/test/str_cat_test.cpp
T
Gleb Mazovetskiy e35595a1eb StrCat improvements
1. Use `fmt::format_int` directly instead of parsing a format string.
2. Use `AppendStrView`.
3. Define the varargs versions using fold expressions when available.
4. Add tests.
2023-03-13 10:20:38 +00:00

22 lines
387 B
C++

#include <gtest/gtest.h>
#include "utils/str_cat.hpp"
namespace devilution {
namespace {
TEST(StrCatTest, StrCatBasicTest)
{
EXPECT_EQ(StrCat("a", "b", "c", 5), "abc5");
}
TEST(StrCatTest, BufCopyBasicTest)
{
char buf[5];
char *end = BufCopy(buf, "a", "b", "c", 5);
EXPECT_EQ(string_view(buf, end - buf), "abc5");
}
} // namespace
} // namespace devilution