using Strata.SqlTools.SqlBreakdown.Utilities; namespace Strata.SqlTools.SqlBreakdown.Tests.Utilities; [TestFixture] public class StringUtilsTests { [TestCase('a', -842352705)] [TestCase('z', -842352730)] [TestCase('A', -842352673)] [TestCase('Z', -842352698)] [TestCase('0', -842352768)] [TestCase('9', -842352759)] [TestCase(' ', -842352737)] [TestCase('-', -842352782)] public void GetHashCode32Bit_KnownCharacters_ReturnsHardcodedHash(char c, int expected) { // Act & Assert Assert.That(StringUtils.GetHashCode32Bit(c), Is.EqualTo(expected)); } [Test] public void GetHashCode32Bit_UnmappedCharacter_UsesConsistentFallback() { // Arrange - '!' is not in the hardcoded table const char c = '!'; var expected = -842352737 - (int)c; // Act & Assert Assert.That(StringUtils.GetHashCode32Bit(c), Is.EqualTo(expected)); } [Test] public void GetHashCode32Bit_SameCharacter_IsDeterministic() { // Act & Assert - critical: TranslateTextToGuid relies on stable hashing Assert.That(StringUtils.GetHashCode32Bit('q'), Is.EqualTo(StringUtils.GetHashCode32Bit('q'))); } }