From 878dc8f479b9208b53441852e61d91fd0f458152 Mon Sep 17 00:00:00 2001 From: William Chen Date: Mon, 30 Dec 2024 07:53:17 -0500 Subject: [PATCH] Add assert messages --- Numerics/Ray.cs | 4 ++-- Utilities/StringUtility.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Numerics/Ray.cs b/Numerics/Ray.cs index d7bfb1a..5f4dd1d 100644 --- a/Numerics/Ray.cs +++ b/Numerics/Ray.cs @@ -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; diff --git a/Utilities/StringUtility.cs b/Utilities/StringUtility.cs index 4131ea2..7adc139 100644 --- a/Utilities/StringUtility.cs +++ b/Utilities/StringUtility.cs @@ -18,7 +18,7 @@ public static string UpdateNewLines(string text) /// 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);