18 lines
657 B
C#
18 lines
657 B
C#
global using static SimpleHttpServer.GlobalUsings;
|
|
using SimpleHttpServer.Types.Exceptions;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
namespace SimpleHttpServer;
|
|
internal static class GlobalUsings {
|
|
internal static void Assert([DoesNotReturnIf(false)] bool b, string? message = null) {
|
|
if (!b) {
|
|
if (message == null)
|
|
throw new AssertionFailedException("An assertion has failed!");
|
|
else
|
|
throw new AssertionFailedException($"An assertion has failed: {message}");
|
|
}
|
|
}
|
|
|
|
internal static void AssertImplies(bool x, bool y, string? message = null) => Assert(!x || y, message);
|
|
}
|