feat: added more assert methods

This commit is contained in:
2025-10-22 11:04:44 +03:00
parent 0db2cae1bb
commit 4b756fa232

View File

@@ -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");