public void TestCompareTo_GreaterThan() { DistanceNode thisNode = new DistanceNode(new Point(RandomVector()), new Point(RandomVector()), 0.5f); DistanceNode otherNode = new DistanceNode(new Point(RandomVector()), new Point(RandomVector()), 0.2f); int expected = 1; int actual = thisNode.CompareTo(otherNode); Assert.That(actual, Is.EqualTo(expected)); }
public void TestCompareTo_EqualToDistanceAndStaticEqual() { float distance = Random.value; DistanceNode thisNode = new DistanceNode( new Point(new Vector3(1.0f, 2.0f, 3.0f)), new Point(new Vector3(1.0f, 2.0f, 3.0f)), distance ); DistanceNode otherNode = new DistanceNode( new Point(new Vector3(1.0f, 2.0f, 3.0f)), new Point(new Vector3(100.0f, 200.0f, 300.0f)), distance ); int actual = thisNode.CompareTo(otherNode); int expected = -1; Assert.That(actual, Is.EqualTo(expected)); }
public void TestCompareTo_EqualTo() { float distance = Random.value; DistanceNode thisNode = new DistanceNode( new Point(new Vector3(1.0f, 2.0f, 3.0f)), new Point(new Vector3(4.0f, 2.0f, 5.0f)), distance ); DistanceNode otherNode = new DistanceNode( new Point(new Vector3(1.0f, 2.0f, 3.0f)), new Point(new Vector3(4.0f, 2.0f, 5.0f)), distance ); int actual1 = thisNode.CompareTo(otherNode); int actual2 = otherNode.CompareTo(thisNode); int expected = 0; Assert.That(actual1, Is.EqualTo(expected)); Assert.That(actual2, Is.EqualTo(expected)); }