mirror of
https://github.com/libretro/devilutionX.git
synced 2026-11-10 10:51:25 -10:00
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.
22 lines
387 B
C++
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
|