From 4b756fa232c51b55be39cebe623094cb12a69e27 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Wed, 22 Oct 2025 11:04:44 +0300 Subject: [PATCH] feat: added more assert methods --- Engine.Core/Debug/AssertHelpers.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Engine.Core/Debug/AssertHelpers.cs b/Engine.Core/Debug/AssertHelpers.cs index 6a2f9e5..4f0ea05 100644 --- a/Engine.Core/Debug/AssertHelpers.cs +++ b/Engine.Core/Debug/AssertHelpers.cs @@ -4,6 +4,22 @@ namespace Engine.Core.Debug; public static class Assert { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void AssertTrue(bool value, string errorMessage) + => System.Diagnostics.Debug.Assert(value, errorMessage); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void AssertFalse(bool value, string errorMessage) + => System.Diagnostics.Debug.Assert(!value, errorMessage); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void AssertNull(object? value, string errorMessage) + => System.Diagnostics.Debug.Assert(value is null, errorMessage); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void AssertNotNull(object? value, string errorMessage) + => System.Diagnostics.Debug.Assert(value is not null, errorMessage); + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void AssertInitialized(IInitializable initializable) => System.Diagnostics.Debug.Assert(initializable.IsInitialized, $"{initializable.GetType().Name} must be initialized");