summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/gtest/test_casing.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /toolkit/components/places/tests/gtest/test_casing.cpp
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/places/tests/gtest/test_casing.cpp')
-rw-r--r--toolkit/components/places/tests/gtest/test_casing.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/toolkit/components/places/tests/gtest/test_casing.cpp b/toolkit/components/places/tests/gtest/test_casing.cpp
new file mode 100644
index 0000000000..079d64bbd0
--- /dev/null
+++ b/toolkit/components/places/tests/gtest/test_casing.cpp
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+#include "mozilla/intl/UnicodeProperties.h"
+
+// Verify the assertion in SQLFunctions.cpp / nextSearchCandidate that the
+// only non-ASCII characters that lower-case to ASCII ones are:
+// * U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE
+// * U+212A KELVIN SIGN
+TEST(MatchAutocompleteCasing, CaseAssumption)
+{
+ for (uint32_t c = 128; c < 0x110000; c++) {
+ if (c != 304 && c != 8490) {
+ ASSERT_GE(mozilla::intl::UnicodeProperties::ToLower(c), 128U);
+ }
+ }
+}
+
+// Verify the assertion that all ASCII characters lower-case to ASCII.
+TEST(MatchAutocompleteCasing, CaseAssumption2)
+{
+ for (uint32_t c = 0; c < 128; c++) {
+ ASSERT_LT(mozilla::intl::UnicodeProperties::ToLower(c), 128U);
+ }
+}