mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Robust.UnitTesting was both ALL tests for RT, and also API surface for content tests. Tests are now split into separate projects as appropriate, and the API side has also been split off.
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using NUnit.Framework;
|
|
|
|
namespace Robust.Shared.Maths.Tests
|
|
{
|
|
[TestFixture, Parallelizable, TestOf(typeof(Box2i))]
|
|
internal sealed class Box2i_Test
|
|
{
|
|
[Test]
|
|
public void Box2iUnion()
|
|
{
|
|
var boxOne = new Box2i(-1, -1, 1, 1);
|
|
var boxTwo = new Box2i(0, 0, 2, 2);
|
|
|
|
var result = boxOne.Union(boxTwo);
|
|
|
|
Assert.That(result.Left, Is.EqualTo(-1));
|
|
Assert.That(result.Bottom, Is.EqualTo(-1));
|
|
Assert.That(result.Right, Is.EqualTo(2));
|
|
Assert.That(result.Top, Is.EqualTo(2));
|
|
}
|
|
|
|
[Test]
|
|
public void Box2iVector2iUnion()
|
|
{
|
|
var box = new Box2i();
|
|
Assert.That(box, Is.EqualTo(Box2i.Empty));
|
|
|
|
box = box.UnionTile(Vector2i.Zero);
|
|
Assert.That(box.Right, Is.EqualTo(1));
|
|
|
|
box = box.UnionTile(Vector2i.One);
|
|
Assert.That(box.Top, Is.EqualTo(2));
|
|
|
|
box = box.Union(new Vector2i(2, 0));
|
|
Assert.That(box.Right, Is.EqualTo(2));
|
|
}
|
|
}
|
|
}
|