示例#1
0
        public void BoundsWalker_5_3()
        {
            var items = SpotSet.BoundsWalker(5, 3).ToList();

            Assert.AreEqual(5 + 5 + 3 + 3, items.Count, "items.Count");

            Assert.AreEqual(0, items.Select(i => i.x).Min(), "min x");
            Assert.AreEqual(6, items.Select(i => i.x).Max(), "max x");
            Assert.AreEqual(0, items.Select(i => i.y).Min(), "min y");
            Assert.AreEqual(4, items.Select(i => i.y).Max(), "max y");

            Assert.AreEqual((1, 0), items[0], "item 0");
            Assert.AreEqual((2, 0), items[1], "item 1");
            Assert.AreEqual((3, 0), items[2], "item 2");
            Assert.AreEqual((4, 0), items[3], "item 3");
            Assert.AreEqual((5, 0), items[4], "item 4");
            Assert.AreEqual((6, 1), items[5], "item 5");
            Assert.AreEqual((6, 2), items[6], "item 6");
            Assert.AreEqual((6, 3), items[7], "item 7");
            Assert.AreEqual((5, 4), items[8], "item 8");
            Assert.AreEqual((4, 4), items[9], "item 9");
            Assert.AreEqual((3, 4), items[10], "item 10");
            Assert.AreEqual((2, 4), items[11], "item 11");
            Assert.AreEqual((1, 4), items[12], "item 12");
            Assert.AreEqual((0, 3), items[13], "item 13");
            Assert.AreEqual((0, 2), items[14], "item 14");
            Assert.AreEqual((0, 1), items[15], "item 15");
        }
示例#2
0
        public void BoundsWalker_1_1()
        {
            var items = SpotSet.BoundsWalker(1, 1).ToList();

            Assert.AreEqual(4, items.Count, "items.Count");

            Assert.AreEqual((1, 0), items[0], "item 0");
            Assert.AreEqual((2, 1), items[1], "item 1");
            Assert.AreEqual((1, 2), items[2], "item 2");
            Assert.AreEqual((0, 1), items[3], "item 3");
        }
示例#3
0
        public void BoundsWalker_7_5()
        {
            var items = SpotSet.BoundsWalker(7, 5).ToList();

            Assert.AreEqual(7 + 7 + 5 + 5, items.Count, "items.Count");

            Assert.AreEqual(0, items.Select(i => i.x).Min(), "min x");
            Assert.AreEqual(8, items.Select(i => i.x).Max(), "max x");
            Assert.AreEqual(0, items.Select(i => i.y).Min(), "min y");
            Assert.AreEqual(6, items.Select(i => i.y).Max(), "max y");

            Assert.AreEqual((1, 0), items[0], "item 0");
            Assert.AreEqual((2, 0), items[1], "item 1");
            Assert.AreEqual((3, 0), items[2], "item 2");
            Assert.AreEqual((4, 0), items[3], "item 3");
            Assert.AreEqual((5, 0), items[4], "item 4");
            Assert.AreEqual((6, 0), items[5], "item 5");
            Assert.AreEqual((7, 0), items[6], "item 6");
            Assert.AreEqual((8, 1), items[7], "item 7");
            Assert.AreEqual((8, 2), items[8], "item 8");
            Assert.AreEqual((8, 3), items[9], "item 9");
            Assert.AreEqual((8, 4), items[10], "item 10");
            Assert.AreEqual((8, 5), items[11], "item 11");
            Assert.AreEqual((7, 6), items[12], "item 12");
            Assert.AreEqual((6, 6), items[13], "item 13");
            Assert.AreEqual((5, 6), items[14], "item 14");
            Assert.AreEqual((4, 6), items[15], "item 15");
            Assert.AreEqual((3, 6), items[16], "item 16");
            Assert.AreEqual((2, 6), items[17], "item 17");
            Assert.AreEqual((1, 6), items[18], "item 18");
            Assert.AreEqual((0, 5), items[19], "item 19");
            Assert.AreEqual((0, 4), items[20], "item 20");
            Assert.AreEqual((0, 3), items[21], "item 21");
            Assert.AreEqual((0, 2), items[22], "item 22");
            Assert.AreEqual((0, 1), items[23], "item 23");

            //for (int i = 0; i < items.Count; i++)
            //{
            //    var item = items[i];
            //    Debug.WriteLine($"Assert.AreEqual(({item.x}, {item.y}), items[{i}], \"item {i}\");");
            //}
        }