public void TopBottomWalkingTest()
        {
            {
                var planes = new List <(double z, bool bottom)>()
                {
                    (0, false),
                    (5, true),
                    (10, false),
                };

                int bottom = SupportGenerator.GetNextBottom(0, planes);
                Assert.AreEqual(1, bottom);

                int bottom1 = SupportGenerator.GetNextBottom(1, planes);
                Assert.AreEqual(0, bottom);
            }

            {
                var planes = new List <(double z, bool bottom)>()
                {
                    (10, false),
                    (10, true),
                    (20, false)
                };

                int bottom = SupportGenerator.GetNextBottom(0, planes);
                Assert.AreEqual(0, bottom);
            }
        }
        public void TopBottomWalkingTest()
        {
            // a box in the air
            {
                var planes = new List <(double z, bool bottom)>()
                {
                    (0, false),                      // top at 0 (the bed)
                    (5, true),                       // bottom at 5 (the bottom of a box)
                    (10, false),                     // top at 10 (the top of the box)
                };

                int bottom = SupportGenerator.GetNextBottom(0, planes, 0);
                Assert.AreEqual(1, bottom);                 // we get the bottom

                int bottom1 = SupportGenerator.GetNextBottom(1, planes, 0);
                Assert.AreEqual(-1, bottom1, "There are no more bottoms so we get back a -1.");
            }

            // two boxes, the bottom touching the bed, the top touching the bottom
            {
                var planes = new List <(double z, bool bottom)>()
                {
                    (0, false),                     // top at 0 (the bed)
                    (0, true),                      // bottom at 0 (box a on bed)
                    (10, false),                    // top at 10 (box a top)
                    (10, true),                     // bottom at 10 (box b bottom)
                    (20, false)                     // top at 20 (box b top)
                };

                int bottom = SupportGenerator.GetNextBottom(0, planes, 0);
                Assert.AreEqual(-1, bottom, "The boxes are sitting on the bed and no support is required");
            }

            // two boxes, the bottom touching the bed, the top inside the bottom
            {
                var planes = new List <(double z, bool bottom)>()
                {
                    (0, false),                    // top at 0 (the bed)
                    (0, true),                     // bottom at 0 (box a on bed)
                    (5, true),                     // bottom at 5 (box b bottom)
                    (10, false),                   // top at 10 (box a top)
                    (20, false)                    // top at 20 (box b top)
                };

                int bottom = SupportGenerator.GetNextBottom(0, planes, 0);
                Assert.AreEqual(-1, bottom, "The boxes are sitting on the bed and no support is required");
            }

            // get next top skips any tops before checking for bottom
            {
                var planes = new List <(double z, bool bottom)>()
                {
                    (0, false),
                    (5, true),
                    (10, false),
                    (20, false),
                    (25, true)
                };

                int top = SupportGenerator.GetNextTop(0, planes, 0);
                Assert.AreEqual(3, top);
            }
        }