diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-04-19 17:19:32 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-04-19 17:19:32 -0400 |
| commit | c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 (patch) | |
| tree | ee4d51c7c1d633e11f46453ef1edd3c77c4ef9f7 /Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-equals.md | |
| download | Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.gz Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.bz2 Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.zip | |
Inital commit
Diffstat (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-equals.md')
| -rw-r--r-- | Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-equals.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-equals.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-equals.md new file mode 100644 index 0000000..8ef8d85 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-equals.md @@ -0,0 +1,27 @@ +# Custom equality comparers with equals operator
+
+If you need to compare Vectors using the overloaded operator == (see [Vector2.operator ==](https://docs.unity3d.com/ScriptReference/Vector2-operator_eq.html), [Vector3.operator ==](https://docs.unity3d.com/ScriptReference/Vector3-operator_eq.html), and [Vector4.operator ==](https://docs.unity3d.com/ScriptReference/Vector4-operator_eq.html)) you should use the respective comparer implementations:
+
+- Vector2ComparerWithEqualsOperator
+- Vector3ComparerWithEqualsOperator
+- Vector4ComparerWithEqualsOperator
+
+The interface is the same as for other [equality comparers](./reference-custom-equality-comparers.md) except the public [constructor](./reference-custom-equality-comparers.md#constructors) `error` parameter is inapplicable in this case.
+
+## Example
+
+```c#
+[TestFixture]
+public class Vector3Test
+{
+ [Test]
+ public void VerifyThat_TwoVector3ObjectsAreEqual()
+ {
+ var actual = new Vector3(10e-7f, 10e-7f, 10e-7f);
+ var expected = new Vector3(0f, 0f, 0f);
+
+ Assert.That(actual, Is.EqualTo(expected).Using(Vector3ComparerWithEqualsOperator.Instance));
+ }
+}
+```
+
|
