NBEngine/engine/NBCore/tests/testUtils.cpp
2026-04-06 02:22:28 -05:00

41 lines
976 B
C++

#define CODE_ERROR_LOCATIONS
#include "Utils.hpp"
#include <gtest/gtest.h>
namespace nb {
TEST(UtilsTest, Test) {
ASSERT_STREQ(
find_and_replace("Jeff", "e", "efe").c_str(),
"Jefeff"
);
auto tmp = find_and_replace("Naif", "a", "afa");
ASSERT_STREQ(
find_and_replace(tmp, "i", "ifi").c_str(),
"Nafaifif"
);
tmp = find_and_replace("aeiou", "a", "afa");
tmp = find_and_replace(tmp, "e", "efe");
tmp = find_and_replace(tmp, "i", "ifi");
tmp = find_and_replace(tmp, "o", "ofo");
tmp = find_and_replace(tmp, "u", "ufu");
ASSERT_STREQ(
tmp.c_str(),
"afaefeifiofoufu"
);
tmp = find_and_replace(tmp, "afa", "a");
tmp = find_and_replace(tmp, "efe", "e");
tmp = find_and_replace(tmp, "ifi", "i");
tmp = find_and_replace(tmp, "ofo", "o");
tmp = find_and_replace(tmp, "ufu", "u");
ASSERT_STREQ(
tmp.c_str(),
"aeiou"
);
}
} // namespace nb