예제 #1
0
        public void TestEncode_Clockwise_Alt()
        {
            var m_permutation = new Mock <PermutationParity>(); var permutation = m_permutation.Object;
            var m_geometric = new Mock <GeometricParity>(); var geometric = m_geometric.Object;

            m_permutation.Setup(n => n.Parity(It.IsAny <long[]>())).Returns(+1);
            m_geometric.SetupGet(n => n.Parity).Returns(-1);

            IStereoEncoder encoder = new GeometryEncoder(new int[] { 1 }, permutation, geometric);

            long[] prev   = new long[3];
            long[] result = new long[3];
            Arrays.Fill(prev, 1);
            Arrays.Fill(result, 1);

            // check returned true
            Assert.IsTrue(encoder.Encode(prev, result));

            // check only the value at index '1' was changed
            Assert.IsTrue(Compares.AreDeepEqual(new long[] { 1, 15543053, 1 }, result));
        }
예제 #2
0
        public void TestEncode_NoGeometry()
        {
            var m_permutation = new Mock <PermutationParity>(); var permutation = m_permutation.Object;
            var m_geometric = new Mock <GeometricParity>(); var geometric = m_geometric.Object;

            m_permutation.Setup(n => n.Parity(It.IsAny <long[]>())).Returns(+1);
            m_geometric.SetupGet(n => n.Parity).Returns(0);

            IStereoEncoder encoder = new GeometryEncoder(new int[] { 1, 3 }, permutation, geometric);

            long[] prev   = new long[6];
            long[] result = new long[6];
            Arrays.Fill(prev, 1);
            Arrays.Fill(result, 1);

            // check returned true. the permutation was okay, but no geometry, this
            // will never change
            Assert.IsTrue(encoder.Encode(prev, result));

            // check no values modified
            Assert.IsTrue(Compares.AreDeepEqual(new long[] { 1, 1, 1, 1, 1, 1 }, result));
        }
예제 #3
0
        public void TestEncode_NoPermutation()
        {
            var m_permutation = new Mock <PermutationParity>(); var permutation = m_permutation.Object;
            var m_geometric = new Mock <GeometricParity>(); var geometric = m_geometric.Object;

            m_permutation.Setup(n => n.Parity(It.IsAny <long[]>())).Returns(0);
            m_geometric.SetupGet(n => n.Parity).Returns(+1);

            IStereoEncoder encoder = new GeometryEncoder(new int[] { 1, 3 }, permutation, geometric);

            long[] prev   = new long[6];
            long[] result = new long[6];
            Arrays.Fill(prev, 1);
            Arrays.Fill(result, 1);

            // check returned false, the permutation changes for each cycle
            Assert.IsFalse(encoder.Encode(prev, result));

            // check no values modified
            Assert.IsTrue(Compares.AreDeepEqual(new long[] { 1, 1, 1, 1, 1, 1 }, result));

            // geometric parity should not be called
            m_geometric.Verify(n => n.Parity, Times.Never());
        }