Made errors mostly work as hoped

This commit is contained in:
NaifBanana
2026-06-11 04:24:06 -05:00
parent d448b6724a
commit 0b473c0f8a
13 changed files with 284 additions and 142 deletions
+41
View File
@@ -0,0 +1,41 @@
#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