public void testTraversalOrder() { for (var r = 0; r < 4; ++r) { for (var i = 0; i < 4; ++i) { // Check consistency with respect to swapping axes. assertEquals(S2.IjToPos(r, i), S2.IjToPos(r ^ S2.SwapMask, swapAxes(i))); assertEquals(S2.PosToIj(r, i), swapAxes(S2.PosToIj(r ^ S2.SwapMask, i))); // Check consistency with respect to reversing axis directions. assertEquals(S2.IjToPos(r, i), S2.IjToPos(r ^ S2.InvertMask, invertBits(i))); assertEquals(S2.PosToIj(r, i), invertBits(S2.PosToIj(r ^ S2.InvertMask, i))); // Check that the two tables are inverses of each other. assertEquals(S2.IjToPos(r, S2.PosToIj(r, i)), i); assertEquals(S2.PosToIj(r, S2.IjToPos(r, i)), i); } } }