1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Improve strlogicalcmp for strings of unequal lengths

This version actually works and doesn't overrun provided buffers
This commit is contained in:
Michał Janiszewski
2020-03-27 12:54:14 +01:00
parent d2565af867
commit 16d8c64cea
2 changed files with 31 additions and 28 deletions

View File

@@ -12,6 +12,7 @@
#include <gtest/gtest.h>
#include <openrct2/core/String.hpp>
#include <openrct2/util/Util.h>
#include <string>
#include <tuple>
#include <utility>
@@ -147,3 +148,10 @@ TEST_F(StringTest, ToUpper_Japanese)
auto actual = String::ToUpper(u8"日本語で大文字がなし");
ASSERT_STREQ(actual.c_str(), u8"日本語で大文字がなし");
}
TEST_F(StringTest, strlogicalcmp)
{
auto res1 = strlogicalcmp("foo1", "foo1_2");
auto res2 = strlogicalcmp("foo1_2", "foo1");
ASSERT_NE(res1, res2);
}