Files
DevilutionX/test/str_cat_test.cpp
Gleb Mazovetskiy 3bcc869d85 Replace fmt with utils/str_cat in a few places
`fmt::format_to` is overkill for our simple formatting needs.
2025-09-29 08:36:34 +01:00

29 lines
522 B
C++

#include <cstdint>
#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, LeftPadTest)
{
EXPECT_EQ(StrCat(LeftPad(static_cast<uint8_t>(5), 2, '0')), "05");
}
TEST(StrCatTest, BufCopyBasicTest)
{
char buf[5];
char *end = BufCopy(buf, "a", "b", "c", 5);
EXPECT_EQ(std::string_view(buf, end - buf), "abc5");
}
} // namespace
} // namespace devilution