Prove we know the underlying values of hash constants.

Precursor to replacing the hash comparisions with string comparisions,
because that is saner.

Change-Id: I02c1ebe3cb121ed64613e9c7a9d56120fa8bdd30
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83559
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fgas/crt/cfgas_stringformatter.cpp b/xfa/fgas/crt/cfgas_stringformatter.cpp
index d0a284c..2e4296a 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.cpp
+++ b/xfa/fgas/crt/cfgas_stringformatter.cpp
@@ -26,14 +26,6 @@
 // that exploits the well-defined behaviour for unsigned underflow (and hence
 // the standard x < size() can be used in all cases to validate indices).
 
-#define FX_LOCALECATEGORY_DateHash 0xbde9abde
-#define FX_LOCALECATEGORY_TimeHash 0x2d71b00f
-#define FX_LOCALECATEGORY_DateTimeHash 0x158c72ed
-#define FX_LOCALECATEGORY_NumHash 0x0b4ff870
-#define FX_LOCALECATEGORY_TextHash 0x2d08af85
-#define FX_LOCALECATEGORY_ZeroHash 0x568cb500
-#define FX_LOCALECATEGORY_NullHash 0x052931bb
-
 #define FX_NUMSTYLE_Percent 0x01
 #define FX_NUMSTYLE_Exponent 0x02
 #define FX_NUMSTYLE_DotVorv 0x04
diff --git a/xfa/fgas/crt/cfgas_stringformatter.h b/xfa/fgas/crt/cfgas_stringformatter.h
index 3d0f7cd..afdd5ea 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.h
+++ b/xfa/fgas/crt/cfgas_stringformatter.h
@@ -13,6 +13,14 @@
 #include "third_party/base/span.h"
 #include "xfa/fgas/crt/locale_iface.h"
 
+#define FX_LOCALECATEGORY_DateHash 0xbde9abde
+#define FX_LOCALECATEGORY_TimeHash 0x2d71b00f
+#define FX_LOCALECATEGORY_DateTimeHash 0x158c72ed
+#define FX_LOCALECATEGORY_NumHash 0x0b4ff870
+#define FX_LOCALECATEGORY_TextHash 0x2d08af85
+#define FX_LOCALECATEGORY_ZeroHash 0x568cb500
+#define FX_LOCALECATEGORY_NullHash 0x052931bb
+
 class CFX_DateTime;
 class LocaleMgrIface;
 
diff --git a/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp b/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp
index 183d967..f82b77f 100644
--- a/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp
+++ b/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp
@@ -743,3 +743,20 @@
   EXPECT_EQ(CFGAS_StringFormatter::Category::kDate,
             CFGAS_StringFormatter(L"date.long{}").GetCategory());
 }
+
+TEST_F(CFGAS_StringFormatterTest, HashConstants) {
+  EXPECT_EQ(static_cast<uint32_t>(FX_LOCALECATEGORY_DateHash),
+            FX_HashCode_GetW(L"date"));
+  EXPECT_EQ(static_cast<uint32_t>(FX_LOCALECATEGORY_TimeHash),
+            FX_HashCode_GetW(L"time"));
+  EXPECT_EQ(static_cast<uint32_t>(FX_LOCALECATEGORY_DateTimeHash),
+            FX_HashCode_GetW(L"datetime"));
+  EXPECT_EQ(static_cast<uint32_t>(FX_LOCALECATEGORY_NumHash),
+            FX_HashCode_GetW(L"num"));
+  EXPECT_EQ(static_cast<uint32_t>(FX_LOCALECATEGORY_TextHash),
+            FX_HashCode_GetW(L"text"));
+  EXPECT_EQ(static_cast<uint32_t>(FX_LOCALECATEGORY_ZeroHash),
+            FX_HashCode_GetW(L"zero"));
+  EXPECT_EQ(static_cast<uint32_t>(FX_LOCALECATEGORY_NullHash),
+            FX_HashCode_GetW(L"null"));
+}