using System;

namespace EMPlannerVerificationHost;

internal static class Verification
{
    public static void Equal<T>(T expected, T actual, string name)
    {
        if (!Equals(expected, actual))
            throw new InvalidOperationException(name + " expected " + expected + " but was " + actual + ".");
    }

    public static void NearlyEqual(double expected, double actual, string name)
    {
        if (Math.Abs(expected - actual) > 1e-12d)
            throw new InvalidOperationException(name + " expected " + expected + " but was " + actual + ".");
    }

    public static void True(bool condition, string name)
    {
        if (!condition)
            throw new InvalidOperationException(name + " was false.");
    }
}
