Skip to content

Commit

Permalink
Add assert messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Exanite committed Dec 30, 2024
1 parent f885cc1 commit 878dc8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Numerics/Ray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public struct Ray

public Ray(Vector3 origin, Vector3 direction, float length)
{
AssertUtility.IsTrue(length >= 0);
AssertUtility.IsTrue(!float.IsInfinity(length));
AssertUtility.IsTrue(length >= 0, $"{nameof(length)} must be greater than or equal to 0");
AssertUtility.IsTrue(!float.IsInfinity(length), $"{nameof(length)} must not be infinity");

Origin = origin;
Direction = direction;
Expand Down
2 changes: 1 addition & 1 deletion Utilities/StringUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static string UpdateNewLines(string text)
/// </summary>
public static string UpdateNewLines(string text, string newLine)
{
AssertUtility.IsTrue(newLine == "\n" || newLine == "\r\n");
AssertUtility.IsTrue(newLine == "\n" || newLine == "\r\n", $"{nameof(newLine)} must be either \\n or \\r\\n");

using var _ = StringBuilderPool.Acquire(out var builder);

Expand Down

0 comments on commit 878dc8f

Please sign in to comment.