Exemple #1
0
        public void CompareToTests(float ev1X1, float ev1X2, float ev2X1, float ev2X2, int expected)
        {
            var rnd    = new Pcg();
            var ev1Y1  = rnd.NextFloat();
            var ev1Y2  = rnd.NextFloat();
            var ev2Y1  = rnd.NextFloat();
            var ev2Y2  = rnd.NextFloat();
            var ev1PtA = new Pointf(ev1X1, ev1Y1);
            var ev1PtB = new Pointf(ev1X2, ev1Y2);
            var ev2PtA = new Pointf(ev2X1, ev2Y1);
            var ev2PtB = new Pointf(ev2X2, ev2Y2);
            var ev1    = new TestEvaluator(ev1PtA, ev1PtB);
            var ev2    = new TestEvaluator(ev2PtA, ev2PtB);

            Assert.That(ev1.CompareTo(ev2), Is.EqualTo(expected));
            Assert.That(ev2.CompareTo(ev1), Is.EqualTo(-expected));
        }
Exemple #2
0
        public void DefaultConstructorTest()
        {
            var ev = new TestEvaluator();

            Assert.That(ev.PtA.X, Is.EqualTo(0.0f));
            Assert.That(ev.PtA.Y, Is.EqualTo(0.0f));
            Assert.That(ev.PtB.X, Is.EqualTo(1.0f));
            Assert.That(ev.PtB.Y, Is.EqualTo(1.0f));
            var interval = new Interval <float>(0f, 1f);

            Assert.That(ev.XInterval, Is.EqualTo(interval));
            Assert.That(ev.YInterval, Is.EqualTo(interval));
            Assert.That(ev.MinX, Is.EqualTo(0.0f));
            Assert.That(ev.MaxX, Is.EqualTo(1.0f));
            Assert.That(ev.MinY, Is.EqualTo(0.0f));
            Assert.That(ev.MaxY, Is.EqualTo(1.0f));
        }
Exemple #3
0
        public void TwoPointConstructorTest()
        {
            var ptA = new Pointf(-1.0f, -1.0f);
            var ptB = new Pointf(1.0f, 1.0f);
            var ev  = new TestEvaluator(ptA, ptB);

            Assert.That(ev.PtA.X, Is.EqualTo(-1.0f));
            Assert.That(ev.PtA.Y, Is.EqualTo(0.0f));
            Assert.That(ev.PtB.X, Is.EqualTo(1.0f));
            Assert.That(ev.PtB.Y, Is.EqualTo(1.0f));
            var xInterval = new Interval <float>(-1f, 1f);
            var yInterval = new Interval <float>(0f, 1f);

            Assert.That(ev.XInterval, Is.EqualTo(xInterval));
            Assert.That(ev.YInterval, Is.EqualTo(yInterval));
            Assert.That(ev.MinX, Is.EqualTo(-1.0f));
            Assert.That(ev.MaxX, Is.EqualTo(1.0f));
            Assert.That(ev.MinY, Is.EqualTo(0.0f));
            Assert.That(ev.MaxY, Is.EqualTo(1.0f));
        }