Skip to content

Commit

Permalink
Remove max char from Lexer, deprecated, use MaxBufferLength instead
Browse files Browse the repository at this point in the history
  • Loading branch information
p3nGu1nZz committed Apr 9, 2024
1 parent 2e4c128 commit a4f9ab5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion Assets/Scripts/Agents/Lexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Agents/Transformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Tests/TransformerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}

Expand Down Expand Up @@ -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.");
}

Expand Down

0 comments on commit a4f9ab5

Please sign in to comment.