expected | The expected value. |
actual | Actual value to be compared with the expected value. |
allowedAbsoluteError | The permissible tolerance. |
bool Returns true if the actual value is equaivalent to the expected value under the given tolerance.
Compares two float values for equality.
This method compares two floating point numbers for equality under the given absolute tolerance.
using UnityEngine.TestTools.Utils;
using NUnit.Framework;
[TestFixture]
class UtilsTest { [Test]
public void FloatsAreAbsoluteEqual() { float expected = 0f;
float actual = 10e-6f;
float error = 10e-5f;
Assert.That(Utils.AreFloatsEqualAbsoluteError(expected, actual, error), Is.True); } }