Improve strlogicalcmp for strings of unequal lengths

This version actually works and doesn't overrun provided buffers
This commit is contained in:
Michał Janiszewski committed 2020-05-20 08:33:25 +02:00
1 parent d2565af867
commit 16d8c64cea
2 files changed
+31 -28

No files matched your search

+8
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);
}