From a4f9ab5341ecc09c32a1ea93376bed4ae118e832 Mon Sep 17 00:00:00 2001 From: "K. R." Date: Tue, 9 Apr 2024 15:20:25 -0400 Subject: [PATCH] Remove max char from Lexer, deprecated, use MaxBufferLength instead --- Assets/Scripts/Agents/Lexer.cs | 1 - Assets/Scripts/Agents/Transformer.cs | 2 +- Tests/TransformerTests.cs | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Agents/Lexer.cs b/Assets/Scripts/Agents/Lexer.cs index 3f4e71a..ed034e1 100644 --- a/Assets/Scripts/Agents/Lexer.cs +++ b/Assets/Scripts/Agents/Lexer.cs @@ -10,7 +10,6 @@ namespace DialogosEngine { public static class Lexer { - public const int k_MaxChars = 1000; public const int k_MaxBufferLength = 1000; public const float k_ByteMultiplier = 1.0f / (1 << 23); diff --git a/Assets/Scripts/Agents/Transformer.cs b/Assets/Scripts/Agents/Transformer.cs index ea3f797..4310b77 100644 --- a/Assets/Scripts/Agents/Transformer.cs +++ b/Assets/Scripts/Agents/Transformer.cs @@ -14,7 +14,7 @@ public static float Transform(ref float value) public static int RoundMax(ref float value) { - return Mathf.RoundToInt(Transform(ref value) * Lexer.k_MaxChars); + return Mathf.RoundToInt(Transform(ref value) * Lexer.k_MaxBufferLength); } public static float[] SoftMax(ref float[] values) diff --git a/Tests/TransformerTests.cs b/Tests/TransformerTests.cs index 4cd7d9f..1165f6b 100644 --- a/Tests/TransformerTests.cs +++ b/Tests/TransformerTests.cs @@ -33,7 +33,7 @@ public void RoundMax_ShouldCorrectlyRoundFirstValue() TestContext.WriteLine($"Rounded max result: {result}"); // Assert - Assert.That(result, Is.InRange(0, Lexer.k_MaxChars), "The result should be within the range [0, Lexer.k_MaxChars]."); + Assert.That(result, Is.InRange(0, Lexer.k_MaxBufferLength), "The result should be within the range [0, Lexer.k_MaxChars]."); TestContext.WriteLine($"Test passed: The rounded max result is within the expected range."); } @@ -94,7 +94,7 @@ public void RoundMax_ShouldHandleZeroAndMaxValues() // Assert Assert.That(zeroResult, Is.EqualTo(0), "The rounded result for zero value should be 0."); - Assert.That(maxResult, Is.EqualTo(Lexer.k_MaxChars), "The rounded result for max value should be Lexer.k_MaxChars."); + Assert.That(maxResult, Is.EqualTo(Lexer.k_MaxBufferLength), "The rounded result for max value should be Lexer.k_MaxChars."); TestContext.WriteLine($"Test passed: The rounded max results for zero and max values are within the expected range."); }