feat: added more assert methods
This commit is contained in:
@@ -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");
|
||||
|
Reference in New Issue
Block a user