2019-12-30 06:19:10 +00:00
|
|
|
|
using NUnit.Framework;
|
2019-10-25 23:20:43 +00:00
|
|
|
|
using FluentAssertions;
|
|
|
|
|
|
|
|
|
|
using MoonTools.Core.Bonk;
|
|
|
|
|
using MoonTools.Core.Structs;
|
2019-10-31 23:19:30 +00:00
|
|
|
|
using System.Numerics;
|
2019-12-09 03:46:08 +00:00
|
|
|
|
using System.Collections.Immutable;
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
namespace Tests
|
|
|
|
|
{
|
2019-12-09 03:46:08 +00:00
|
|
|
|
public static class EqualityTests
|
2019-10-25 23:20:43 +00:00
|
|
|
|
{
|
2019-12-02 06:21:50 +00:00
|
|
|
|
public class PointTests
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void PointEqual()
|
|
|
|
|
{
|
2020-01-01 02:23:06 +00:00
|
|
|
|
var a = new Point();
|
|
|
|
|
var b = new Point();
|
2019-12-02 06:21:50 +00:00
|
|
|
|
|
2019-12-30 06:19:10 +00:00
|
|
|
|
a.Equals(b).Should().BeTrue();
|
2019-12-02 06:21:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void PointEqualOperator()
|
|
|
|
|
{
|
2020-01-01 02:23:06 +00:00
|
|
|
|
var a = new Point();
|
|
|
|
|
var b = new Point();
|
2019-12-02 06:21:50 +00:00
|
|
|
|
(a == b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void PointNotEqualOperator()
|
|
|
|
|
{
|
2020-01-01 02:23:06 +00:00
|
|
|
|
var a = new Point();
|
|
|
|
|
var b = new Point();
|
2019-12-02 06:21:50 +00:00
|
|
|
|
|
2020-01-01 02:23:06 +00:00
|
|
|
|
(a != b).Should().BeFalse();
|
2019-12-02 06:21:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-25 23:20:43 +00:00
|
|
|
|
public class CircleTests
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void CircleEqual()
|
|
|
|
|
{
|
|
|
|
|
var a = new Circle(2);
|
|
|
|
|
var b = new Circle(2);
|
|
|
|
|
|
|
|
|
|
(a.Equals(b)).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void CircleNotEqual()
|
|
|
|
|
{
|
|
|
|
|
var a = new Circle(2);
|
|
|
|
|
var b = new Circle(3);
|
|
|
|
|
|
|
|
|
|
(a.Equals(b)).Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void CircleEqualOperator()
|
|
|
|
|
{
|
|
|
|
|
var a = new Circle(2);
|
|
|
|
|
var b = new Circle(2);
|
|
|
|
|
|
|
|
|
|
(a == b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void CircleNotEqualOperator()
|
|
|
|
|
{
|
|
|
|
|
var a = new Circle(2);
|
|
|
|
|
var b = new Circle(3);
|
|
|
|
|
|
|
|
|
|
(a != b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LineTests
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void LineEqual()
|
|
|
|
|
{
|
|
|
|
|
var a = new Line(new Position2D(0, 2), new Position2D(2, 4));
|
|
|
|
|
var b = new Line(new Position2D(0, 2), new Position2D(2, 4));
|
|
|
|
|
|
|
|
|
|
a.Equals(b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void LineEqualOperator()
|
|
|
|
|
{
|
|
|
|
|
var a = new Line(new Position2D(0, 2), new Position2D(2, 4));
|
|
|
|
|
var b = new Line(new Position2D(0, 2), new Position2D(2, 4));
|
|
|
|
|
|
|
|
|
|
(a == b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void LineNotEqual()
|
|
|
|
|
{
|
|
|
|
|
var a = new Line(new Position2D(-2, 4), new Position2D(2, 4));
|
|
|
|
|
var b = new Line(new Position2D(0, 3), new Position2D(5, 1));
|
|
|
|
|
|
|
|
|
|
a.Equals(b).Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void LineNotEqualOperator()
|
|
|
|
|
{
|
|
|
|
|
var a = new Line(new Position2D(-2, 4), new Position2D(2, 4));
|
|
|
|
|
var b = new Line(new Position2D(0, 3), new Position2D(5, 1));
|
|
|
|
|
|
|
|
|
|
(a != b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void LineReversedEqual()
|
|
|
|
|
{
|
|
|
|
|
var a = new Line(new Position2D(0, 2), new Position2D(2, 4));
|
|
|
|
|
var b = new Line(new Position2D(2, 4), new Position2D(0, 2));
|
|
|
|
|
|
|
|
|
|
a.Equals(b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void LineReversedEqualOperator()
|
|
|
|
|
{
|
|
|
|
|
var a = new Line(new Position2D(0, 2), new Position2D(2, 4));
|
|
|
|
|
var b = new Line(new Position2D(2, 4), new Position2D(0, 2));
|
|
|
|
|
|
|
|
|
|
(a == b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class RectangleTests
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void RectangleEqual()
|
|
|
|
|
{
|
2020-01-02 09:40:03 +00:00
|
|
|
|
var a = new Rectangle(3, 3);
|
|
|
|
|
var b = new Rectangle(3, 3);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
a.Equals(b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void RectangleEqualOperator()
|
|
|
|
|
{
|
2020-01-02 09:40:03 +00:00
|
|
|
|
var a = new Rectangle(3, 3);
|
|
|
|
|
var b = new Rectangle(3, 3);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
(a == b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void RectangleNotEqual()
|
|
|
|
|
{
|
2020-01-02 09:40:03 +00:00
|
|
|
|
var a = new Rectangle(3, 3);
|
|
|
|
|
var b = new Rectangle(6, 6);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
a.Equals(b).Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void RectangleNotEqualOperator()
|
|
|
|
|
{
|
2020-01-02 09:40:03 +00:00
|
|
|
|
var a = new Rectangle(3, 3);
|
|
|
|
|
var b = new Rectangle(6, 6);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
(a != b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class PolygonTests
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void PolygonEqual()
|
|
|
|
|
{
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var a = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(0, 1),
|
|
|
|
|
new Position2D(1, 2),
|
|
|
|
|
new Position2D(-1, -1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var b = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(0, 1),
|
|
|
|
|
new Position2D(1, 2),
|
|
|
|
|
new Position2D(-1, -1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
a.Equals(b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void PolygonEqualOperator()
|
|
|
|
|
{
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var a = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(0, 1),
|
|
|
|
|
new Position2D(1, 2),
|
|
|
|
|
new Position2D(-1, -1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var b = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(0, 1),
|
|
|
|
|
new Position2D(1, 2),
|
|
|
|
|
new Position2D(-1, -1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
(a == b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void PolygonDifferentOrderEqual()
|
|
|
|
|
{
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var a = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(0, 1),
|
|
|
|
|
new Position2D(1, 2),
|
|
|
|
|
new Position2D(-1, -1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var b = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(1, 2),
|
|
|
|
|
new Position2D(-1, -1),
|
|
|
|
|
new Position2D(0, 1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
a.Equals(b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void PolygonDifferentOrderEqualOperator()
|
|
|
|
|
{
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var a = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(0, 1),
|
|
|
|
|
new Position2D(1, 2),
|
|
|
|
|
new Position2D(-1, -1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var b = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(1, 2),
|
|
|
|
|
new Position2D(-1, -1),
|
|
|
|
|
new Position2D(0, 1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
(a == b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void PolygonNotEqual()
|
|
|
|
|
{
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var a = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(0, 1),
|
|
|
|
|
new Position2D(1, 2),
|
|
|
|
|
new Position2D(-1, -1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var b = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(1, 0),
|
|
|
|
|
new Position2D(2, 1),
|
|
|
|
|
new Position2D(-1, -1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
a.Equals(b).Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void PolygonNotEqualOperator()
|
|
|
|
|
{
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var a = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(0, 1),
|
|
|
|
|
new Position2D(1, 2),
|
|
|
|
|
new Position2D(-1, -1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-12-09 03:46:08 +00:00
|
|
|
|
var b = new Polygon(ImmutableArray.Create(
|
2019-10-25 23:20:43 +00:00
|
|
|
|
new Position2D(1, 0),
|
|
|
|
|
new Position2D(2, 1),
|
|
|
|
|
new Position2D(-1, -1)
|
2019-12-09 03:46:08 +00:00
|
|
|
|
));
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
(a != b).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class SimplexTests
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
2019-10-26 05:00:34 +00:00
|
|
|
|
public void ZeroSimplexEquals()
|
2019-10-25 23:20:43 +00:00
|
|
|
|
{
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexA = new Simplex2D(Vector2.One);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
simplexA.Equals(simplexB).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
2019-10-26 05:00:34 +00:00
|
|
|
|
public void ZeroSimplexEqualsOperator()
|
2019-10-25 23:20:43 +00:00
|
|
|
|
{
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexA = new Simplex2D(Vector2.One);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
(simplexA == simplexB).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
2019-10-26 05:00:34 +00:00
|
|
|
|
public void ZeroSimplexNotEquals()
|
2019-10-25 23:20:43 +00:00
|
|
|
|
{
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexA = new Simplex2D(Vector2.Zero);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
simplexA.Equals(simplexB).Should().BeFalse();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexC = new Simplex2D(Vector2.Zero, Vector2.One);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
simplexA.Equals(simplexC).Should().BeFalse();
|
|
|
|
|
}
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void ZeroSimplexNotEqualsOperator()
|
|
|
|
|
{
|
|
|
|
|
var simplexA = new Simplex2D(Vector2.Zero);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
(simplexA != simplexB).Should().BeTrue();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
2019-10-26 05:00:34 +00:00
|
|
|
|
public void OneSimplexEquals()
|
2019-10-25 23:20:43 +00:00
|
|
|
|
{
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexA = new Simplex2D(Vector2.One, Vector2.Zero);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One, Vector2.Zero);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
simplexA.Equals(simplexB).Should().BeTrue();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexC = new Simplex2D(Vector2.One, Vector2.Zero);
|
|
|
|
|
var simplexD = new Simplex2D(Vector2.Zero, Vector2.One);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
simplexC.Equals(simplexD).Should().BeTrue();
|
|
|
|
|
}
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void OneSimplexEqualsOperator()
|
|
|
|
|
{
|
|
|
|
|
var simplexA = new Simplex2D(Vector2.One, Vector2.Zero);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One, Vector2.Zero);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
(simplexA == simplexB).Should().BeTrue();
|
2019-10-26 05:00:34 +00:00
|
|
|
|
|
|
|
|
|
var simplexC = new Simplex2D(Vector2.One, Vector2.Zero);
|
|
|
|
|
var simplexD = new Simplex2D(Vector2.Zero, Vector2.One);
|
|
|
|
|
|
|
|
|
|
(simplexC == simplexD).Should().BeTrue();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
2019-10-26 05:00:34 +00:00
|
|
|
|
public void OneSimplexNotEquals()
|
2019-10-25 23:20:43 +00:00
|
|
|
|
{
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexA = new Simplex2D(Vector2.One, Vector2.Zero);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One, Vector2.UnitX);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
simplexA.Equals(simplexB).Should().BeFalse();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexC = new Simplex2D(Vector2.One, Vector2.Zero);
|
|
|
|
|
var simplexD = new Simplex2D(Vector2.Zero, Vector2.UnitX);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
simplexC.Equals(simplexD).Should().BeFalse();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexE = new Simplex2D(Vector2.Zero);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
simplexA.Equals(simplexE).Should().BeFalse();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
2019-10-26 05:00:34 +00:00
|
|
|
|
public void OneSimplexNotEqualsOperator()
|
2019-10-25 23:20:43 +00:00
|
|
|
|
{
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexA = new Simplex2D(Vector2.One, Vector2.Zero);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One, Vector2.UnitX);
|
|
|
|
|
|
|
|
|
|
(simplexA == simplexB).Should().BeFalse();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexC = new Simplex2D(Vector2.One, Vector2.Zero);
|
|
|
|
|
var simplexD = new Simplex2D(Vector2.Zero, Vector2.UnitX);
|
|
|
|
|
|
|
|
|
|
(simplexC == simplexD).Should().BeFalse();
|
|
|
|
|
}
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void TwoSimplexEquals()
|
|
|
|
|
{
|
|
|
|
|
var simplexA = new Simplex2D(Vector2.One, Vector2.Zero, Vector2.UnitX);
|
2020-01-02 04:14:47 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexB = new Simplex2D(Vector2.One, Vector2.Zero, Vector2.UnitX);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
simplexA.Equals(simplexB).Should().BeTrue();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2020-01-02 04:14:47 +00:00
|
|
|
|
var simplexC = new Simplex2D(Vector2.Zero, Vector2.One, Vector2.UnitX);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2020-01-02 04:14:47 +00:00
|
|
|
|
simplexA.Equals(simplexC).Should().BeTrue();
|
|
|
|
|
|
|
|
|
|
var simplexD = new Simplex2D(Vector2.UnitX, Vector2.Zero, Vector2.One);
|
|
|
|
|
|
|
|
|
|
simplexA.Equals(simplexD).Should().BeTrue();
|
|
|
|
|
|
|
|
|
|
var simplexE = new Simplex2D(Vector2.One, Vector2.UnitX, Vector2.Zero);
|
|
|
|
|
|
|
|
|
|
simplexA.Equals(simplexE).Should().BeTrue();
|
|
|
|
|
|
|
|
|
|
var simplexF = new Simplex2D(Vector2.Zero, Vector2.UnitX, Vector2.One);
|
|
|
|
|
|
|
|
|
|
simplexA.Equals(simplexF).Should().BeTrue();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
2019-10-26 05:00:34 +00:00
|
|
|
|
public void TwoSimplexEqualsOperator()
|
2019-10-25 23:20:43 +00:00
|
|
|
|
{
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexA = new Simplex2D(Vector2.One, Vector2.Zero, Vector2.UnitX);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One, Vector2.Zero, Vector2.UnitX);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
(simplexA == simplexB).Should().BeTrue();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexC = new Simplex2D(Vector2.One, Vector2.Zero, Vector2.UnitX);
|
|
|
|
|
var simplexD = new Simplex2D(Vector2.Zero, Vector2.One, Vector2.UnitX);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
(simplexC == simplexD).Should().BeTrue();
|
|
|
|
|
}
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void TwoSimplexNotEquals()
|
|
|
|
|
{
|
|
|
|
|
var simplexA = new Simplex2D(Vector2.One, Vector2.UnitY, Vector2.UnitX);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One, Vector2.Zero, Vector2.UnitX);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
|
|
|
|
simplexA.Equals(simplexB).Should().BeFalse();
|
2019-10-26 05:00:34 +00:00
|
|
|
|
|
|
|
|
|
var simplexC = new Simplex2D(Vector2.One, Vector2.Zero, Vector2.UnitX);
|
|
|
|
|
var simplexD = new Simplex2D(Vector2.Zero, Vector2.UnitY, Vector2.UnitX);
|
|
|
|
|
|
|
|
|
|
simplexC.Equals(simplexD).Should().BeFalse();
|
|
|
|
|
|
|
|
|
|
var simplexE = new Simplex2D(Vector2.Zero);
|
|
|
|
|
|
|
|
|
|
simplexA.Equals(simplexE).Should().BeFalse();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
2019-10-26 05:00:34 +00:00
|
|
|
|
public void TwoSimplexNotEqualsOperator()
|
2019-10-25 23:20:43 +00:00
|
|
|
|
{
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexA = new Simplex2D(Vector2.One, Vector2.UnitY, Vector2.UnitX);
|
|
|
|
|
var simplexB = new Simplex2D(Vector2.One, Vector2.Zero, Vector2.UnitX);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
(simplexA == simplexB).Should().BeFalse();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
var simplexC = new Simplex2D(Vector2.One, Vector2.Zero, Vector2.UnitX);
|
|
|
|
|
var simplexD = new Simplex2D(Vector2.Zero, Vector2.UnitY, Vector2.UnitX);
|
2019-10-25 23:20:43 +00:00
|
|
|
|
|
2019-10-26 05:00:34 +00:00
|
|
|
|
(simplexC == simplexD).Should().BeFalse();
|
2019-10-25 23:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-09 03:46:08 +00:00
|
|
|
|
|
|
|
|
|
public class AABBTests
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void Equal()
|
|
|
|
|
{
|
|
|
|
|
var aabb = new AABB(0, 0, 3, 3);
|
|
|
|
|
var other = new AABB(0, 0, 3, 3);
|
|
|
|
|
|
|
|
|
|
(aabb == other).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void NotEqual()
|
|
|
|
|
{
|
|
|
|
|
var aabb = new AABB(0, 0, 3, 3);
|
|
|
|
|
var other = new AABB(0, 0, 6, 6);
|
|
|
|
|
|
|
|
|
|
(aabb != other).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-25 23:20:43 +00:00
|
|
|
|
}
|
2019-12-30 06:19:10 +00:00
|
|
|
|
}
|