using System.Diagnostics;
using UnityEngine.Assertions.Comparers;

namespace XGame.Framework
{
    public partial class Assert
    {
        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreApproximatelyEqual(float expected, float actual)
        {
            AreEqual(expected, actual, FloatComparer.s_ComparerWithDefaultTolerance, null);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreApproximatelyEqual(float expected, float actual, string format, params object[] args)
        {
            AreEqual(expected, actual, FloatComparer.s_ComparerWithDefaultTolerance, format, args);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreApproximatelyEqual<T>(float expected, float actual, T e) where T : System.Exception
        {
            AreEqual(expected, actual, FloatComparer.s_ComparerWithDefaultTolerance, e);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreApproximatelyEqual(float expected, float actual, float tolerance)
        {
            AreApproximatelyEqual(expected, actual, tolerance, null);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreApproximatelyEqual(float expected, float actual, float tolerance, string format, params object[] args)
        {
            AreEqual(expected, actual, new FloatComparer(tolerance), format, args);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreApproximatelyEqual<T>(float expected, float actual, float tolerance, T e) where T : System.Exception
        {
            AreEqual(expected, actual, new FloatComparer(tolerance), e);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreNotApproximatelyEqual(float expected, float actual)
        {
            AreNotEqual(expected, actual, null, FloatComparer.s_ComparerWithDefaultTolerance);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreNotApproximatelyEqual(float expected, float actual, string format, params object[] args)
        {
            AreNotEqual(expected, actual, FloatComparer.s_ComparerWithDefaultTolerance, format, args);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreNotApproximatelyEqual<T>(float expected, float actual, T e) where T : System.Exception
        {
            AreNotEqual(expected, actual, FloatComparer.s_ComparerWithDefaultTolerance, e);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreNotApproximatelyEqual(float expected, float actual, float tolerance)
        {
            AreNotApproximatelyEqual(expected, actual, tolerance, null);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreNotApproximatelyEqual(float expected, float actual, float tolerance, string format, params object[] args)
        {
            AreNotEqual(expected, actual, new FloatComparer(tolerance), format, args);
        }

        [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
        public static void AreNotApproximatelyEqual<T>(float expected, float actual, float tolerance, T e) where T : System.Exception
        {
            AreNotEqual(expected, actual, new FloatComparer(tolerance), e);
        }
    }
}
