Exemplo n.º 1
0
        public unsafe void rowCanCollapseTest()
        {
            RowPermutator permutator = new RowPermutator();

            byte *row1 = (byte *)Marshal.AllocHGlobal(sizeof(byte) * 4);
            byte *row2 = (byte *)Marshal.AllocHGlobal(sizeof(byte) * 4);

            do
            {
                permutator.CopyTo(row1);
                permutator.CopyTo(row2);

                GridFunctions.collapseRow(row1, 1);
                GridFunctions.collapseRow3(row2, 1);

                try
                {
                    Assert.AreEqual(GridFunctions.rowCanCollapse(row1, 0, 1), GridFunctions.rowCanCollapse(row2, 0, 1));
                }
                catch
                {
                    throw;
                }
            }while (permutator.Next());
        }
Exemplo n.º 2
0
        public unsafe void collapseRowTest()
        {
            RowPermutator permutator = new RowPermutator();

            byte *row1 = (byte *)Marshal.AllocHGlobal(sizeof(byte) * 4);
            byte *row2 = (byte *)Marshal.AllocHGlobal(sizeof(byte) * 4);

            do
            {
                permutator.CopyTo(row1);
                permutator.CopyTo(row2);

                GridFunctions.collapseRow(row1, 1);
                GridFunctions.collapseRow3(row2, 1);

                try
                {
                    Assert.AreEqual(*(uint *)row1, *(uint *)row2);
                }
                catch
                {
                    Debug.WriteLine($"{permutator.data[0]} {permutator.data[1]} {permutator.data[2]} {permutator.data[3]}");
                    Debug.WriteLine($"{row1[0]} {row1[1]} {row1[2]} {row1[3]}");
                    Debug.WriteLine($"{row2[0]} {row2[1]} {row2[2]} {row2[3]}");
                    throw;
                }
            }while (permutator.Next());
        }
Exemplo n.º 3
0
        public unsafe void PrintCollapser()
        {
            RowPermutator permutator = new RowPermutator();
            byte *        row1       = (byte *)Marshal.AllocHGlobal(sizeof(byte) * 4);

            do
            {
                permutator.CopyTo(row1);

                Debug.Write($"{row1[0]} {row1[1]} {row1[2]} {row1[3]}: ");
                GridFunctions.collapseRow(row1, 1);
                Debug.WriteLine($"{row1[0]} {row1[1]} {row1[2]} {row1[3]}");
            }while (permutator.Next());
        }