SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
2.0 KiB

4 years ago
  1. # Custom equality comparers
  2. To enable easier verification of custom Unity type values in your tests we provide you with some custom equality comparers:
  3. * [ColorEqualityComparer](./reference-comparer-color.md)
  4. * [FloatEqualityComparer](./reference-comparer-float.md)
  5. * [QuaternionEqualityComparer](./reference-comparer-quaternion.md)
  6. * [Vector2EqualityComparer](./reference-comparer-vector2.md)
  7. * [Vector3EqualityComparer](./reference-comparer-vector3.md)
  8. * [Vector4EqualityComparer](./reference-comparer-vector4.md)
  9. Use these classes to compare two objects of the same type for equality within the range of a given tolerance using [NUnit ](https://github.com/nunit/docs/wiki/Constraints)or [custom constraints](./reference-custom-constraints.md) . Call Instance to apply the default calculation error value to the comparison. To set a specific error value, instantiate a new comparer object using a one argument constructor `ctor(float error)`.
  10. ## Static properties
  11. | Syntax | Description |
  12. | ---------- | ------------------------------------------------------------ |
  13. | `Instance` | A singleton instance of the comparer with a predefined default error value. |
  14. ## Constructors
  15. | Syntax | Description |
  16. | ------------------- | ------------------------------------------------------------ |
  17. | `ctor(float error)` | Creates an instance of comparer with a custom error `value.allowedError`. The relative error to be considered while comparing two values. |
  18. ## Public methods
  19. | Syntax | Description |
  20. | ------------------------------------ | ------------------------------------------------------------ |
  21. | `bool Equals(T expected, T actual);` | Compares the actual and expected objects for equality using a custom comparison mechanism. Returns `true` if expected and actual objects are equal, otherwise it returns `false`. |