Esempio n. 1
0
        public void LargestPointSplitHold()
        {
            var hold         = new Hold(100, 0, 100, 0, 3);
            var largestPoint = new Point {
                Value = 10, X = 70, Y = 70
            };

            hold.AddPoint(largestPoint);
            hold.AddPoint(new Point {
                Value = 0, X = 10, Y = 10
            });
            hold.AddPoint(new Point {
                Value = 1, X = 10, Y = 70
            });
            hold.AddPoint(new Point {
                Value = 2, X = 70, Y = 10
            });

            Assert.AreEqual(largestPoint, hold.LargestPoint);
        }
Esempio n. 2
0
        public void LargestPoint1000Points()
        {
            var hold = new Hold(100, 0, 100, 0, 10);
            var rand = new Random();

            for (int i = 0; i < 999; i++)
            {
                hold.AddPoint(new Point {
                    Value = i, X = rand.Next(0, 101), Y = rand.Next(1, 101)
                });
            }

            var largestPoint = new Point {
                Value = 1000, X = rand.Next(0, 101), Y = rand.Next(1, 101)
            };

            hold.AddPoint(largestPoint);

            Assert.AreEqual(largestPoint, hold.LargestPoint);
        }
Esempio n. 3
0
        public void CreateSubHoldsTestSkinny()
        {
            var hold = new Hold(100, 0, 2, 0, 1);

            hold.AddPoint(new Point {
                Value = 10, X = 0, Y = 0
            });
            hold.AddPoint(new Point {
                Value = 10, X = 0, Y = 80
            });

            Assert.AreEqual(1,
                            hold.Holds.Count(h => h.TopBoundry == 100 && h.BottomBoundry == 51 && h.RightBoundry == 2 && h.LeftBoundry == 2));
            Assert.AreEqual(1,
                            hold.Holds.Count(h => h.TopBoundry == 100 && h.BottomBoundry == 51 && h.RightBoundry == 1 && h.LeftBoundry == 0));
            Assert.AreEqual(1,
                            hold.Holds.Count(h => h.TopBoundry == 50 && h.BottomBoundry == 0 && h.RightBoundry == 2 && h.LeftBoundry == 2));
            Assert.AreEqual(1,
                            hold.Holds.Count(h => h.TopBoundry == 50 && h.BottomBoundry == 0 && h.RightBoundry == 1 && h.LeftBoundry == 0));
            Assert.AreEqual(4, hold.Holds.Count);
        }
Esempio n. 4
0
        public void holdStoresPointsTest()
        {
            var hold = new Hold(100, 0, 100, 0, 4);

            Assert.IsTrue(hold.StoresPoints);
            hold.AddPoint(new Point {
                X = 10, Y = 11, Value = 86
            });
            hold.AddPoint(new Point {
                X = 20, Y = 70, Value = 86
            });
            hold.AddPoint(new Point {
                X = 30, Y = 11, Value = 86
            });
            hold.AddPoint(new Point {
                X = 70, Y = 70, Value = 86
            });
            hold.AddPoint(new Point {
                X = 80, Y = 11, Value = 86
            });                                                                  //This point causes the hold to split.
            Assert.IsFalse(hold.StoresPoints);
        }
Esempio n. 5
0
        public void LargestPointBasicMultiplePoints()
        {
            var hold         = new Hold(100, 0, 100, 0);
            var largestPoint = new Point {
                Value = 10, X = 0, Y = 0
            };

            hold.AddPoint(new Point {
                Value = 0, X = 10, Y = 0
            });
            hold.AddPoint(new Point {
                Value = 1, X = 20, Y = 0
            });
            hold.AddPoint(largestPoint);
            hold.AddPoint(new Point {
                Value = 2, X = 30, Y = 0
            });
            hold.AddPoint(new Point {
                Value = 3, X = 40, Y = 0
            });

            Assert.AreEqual(largestPoint, hold.LargestPoint);
        }