예제 #1
0
        public void TestYSkew()
        {
            int computations;
            var input = new AlgorithmDebuggingInitialDelegate
            {
                ValueShouldBePlacedAt = (x, y, z) => (x == 0 && z == 0)
            };
            var passthrough = new AlgorithmPassthrough();
            var runtimeInput = this.CreateRuntimeLayer(input);
            var runtimePassthough = this.CreateRuntimeLayer(passthrough);
            runtimePassthough.SetInput(0, runtimeInput);

            // We need to check with various borders.
            for (var i = 0; i < 2; i++)
                for (var j = 0; j < 2; j++)
                    for (var k = 0; k < 2; k++)
                    {
                        passthrough.XBorder = i;
                        passthrough.YBorder = j;
                        passthrough.ZBorder = k;
                        var result = runtimePassthough.GenerateData(-16, 0, -16, 32, 32, 32, out computations);

                        // Test the area where we should be filled.
                        for (var y = 0; y < 32; y += 1)
                            Assert.True(result[16 + y*32 + 16*32*32] == 1,
                                "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k +
                                "), value missing.");

                        // Test the areas where we should not be filled.
                        for (var y = 0; y < 32; y += 1)
                            Assert.False(result[17 + y*32 + 15*32*32] == 1,
                                "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k +
                                "), value present at (1, " + y + ", -1).");
                        for (var y = 0; y < 32; y += 1)
                            Assert.False(result[16 + y*32 + 15*32*32] == 1,
                                "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k +
                                "), value present at (0, " + y + ", -1).");
                        for (var y = 0; y < 32; y += 1)
                            Assert.False(result[15 + y*32 + 15*32*32] == 1,
                                "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k +
                                "), value present at (-1, " + y + ", -1).");
                        for (var y = 0; y < 32; y += 1)
                            Assert.False(result[17 + y*32 + 16*32*32] == 1,
                                "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k +
                                "), value present at (1, " + y + ", 0).");
                        for (var y = 0; y < 32; y += 1)
                            Assert.False(result[15 + y*32 + 16*32*32] == 1,
                                "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k +
                                "), value present at (-1, " + y + ", 0).");
                        for (var y = 0; y < 32; y += 1)
                            Assert.False(result[17 + y*32 + 17*32*32] == 1,
                                "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k +
                                "), value present at (1, " + y + ", 1).");
                        for (var y = 0; y < 32; y += 1)
                            Assert.False(result[16 + y*32 + 17*32*32] == 1,
                                "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k +
                                "), value present at (0, " + y + ", 1).");
                        for (var y = 0; y < 32; y += 1)
                            Assert.False(result[15 + y*32 + 17*32*32] == 1,
                                "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k +
                                "), value present at (-1, " + y + ", 1).");
                    }
        }
예제 #2
0
        public void TestYSkew()
        {
            int computations;
            var input = new AlgorithmDebuggingInitialDelegate
            {
                ValueShouldBePlacedAt = (x, y, z) => (x == 0 && z == 0)
            };
            var passthrough       = new AlgorithmPassthrough();
            var runtimeInput      = new RuntimeLayer(input);
            var runtimePassthough = new RuntimeLayer(passthrough);

            runtimePassthough.SetInput(0, runtimeInput);

            // We need to check with various borders.
            for (var i = 0; i < 2; i++)
            {
                for (var j = 0; j < 2; j++)
                {
                    for (var k = 0; k < 2; k++)
                    {
                        passthrough.XBorder = i;
                        passthrough.YBorder = j;
                        passthrough.ZBorder = k;
                        var result = runtimePassthough.GenerateData(-16, 0, -16, 32, 32, 32, out computations);

                        // Test the area where we should be filled.
                        for (var y = 0; y < 32; y += 1)
                        {
                            Assert.True(result[16 + y * 32 + 16 * 32 * 32] == 1, "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k + "), value missing.");
                        }

                        // Test the areas where we should not be filled.
                        for (var y = 0; y < 32; y += 1)
                        {
                            Assert.False(result[17 + y * 32 + 15 * 32 * 32] == 1, "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k + "), value present at (1, " + y + ", -1).");
                        }
                        for (var y = 0; y < 32; y += 1)
                        {
                            Assert.False(result[16 + y * 32 + 15 * 32 * 32] == 1, "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k + "), value present at (0, " + y + ", -1).");
                        }
                        for (var y = 0; y < 32; y += 1)
                        {
                            Assert.False(result[15 + y * 32 + 15 * 32 * 32] == 1, "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k + "), value present at (-1, " + y + ", -1).");
                        }
                        for (var y = 0; y < 32; y += 1)
                        {
                            Assert.False(result[17 + y * 32 + 16 * 32 * 32] == 1, "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k + "), value present at (1, " + y + ", 0).");
                        }
                        for (var y = 0; y < 32; y += 1)
                        {
                            Assert.False(result[15 + y * 32 + 16 * 32 * 32] == 1, "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k + "), value present at (-1, " + y + ", 0).");
                        }
                        for (var y = 0; y < 32; y += 1)
                        {
                            Assert.False(result[17 + y * 32 + 17 * 32 * 32] == 1, "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k + "), value present at (1, " + y + ", 1).");
                        }
                        for (var y = 0; y < 32; y += 1)
                        {
                            Assert.False(result[16 + y * 32 + 17 * 32 * 32] == 1, "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k + "), value present at (0, " + y + ", 1).");
                        }
                        for (var y = 0; y < 32; y += 1)
                        {
                            Assert.False(result[15 + y * 32 + 17 * 32 * 32] == 1, "Skew present on the Y axis with borders (" + i + ", " + j + ", " + k + "), value present at (-1, " + y + ", 1).");
                        }
                    }
                }
            }
        }