Exemple #1
0
        public void TestUlamSpiralGetStartLocationOK()
        {
            UlamSpiral spiral = null;

            int[] location = null;


            spiral = new UlamSpiral(81);
            int[] centerLocation = spiral.GetCenterLocation();


            location = spiral.GetStartLocation(0);

            Assert.AreEqual(location[0], centerLocation[0]); // x
            Assert.AreEqual(location[1], centerLocation[1]); // y

            location = spiral.GetStartLocation(1);

            Assert.AreEqual(location[0], centerLocation[0] + 1); // x
            Assert.AreEqual(location[1], centerLocation[1]);     // y

            location = spiral.GetStartLocation(2);

            Assert.AreEqual(location[0], centerLocation[0] + 2); // x
            Assert.AreEqual(location[1], centerLocation[0] + 1); // y
        }
Exemple #2
0
        public void TestUlamSpiralGetCenterLocation()
        {
            UlamSpiral spiral = null;

            int[] location = null;

            spiral   = new UlamSpiral(9);
            location = spiral.GetCenterLocation();

            Assert.AreEqual(location[0], 1); // x
            Assert.AreEqual(location[1], 1); // y
        }