public void TestGetHammingBytes()
        {
            HammingBase hc = HammingBase.EncodeByteArray(test);

            byte[] testArray = hc.GetHammingBytes();
            Assert.IsNotNull(testArray);

            byte[] cloneArray = new byte[testArray.Length];
            for (int i = 0; i < testArray.Length; i++)
            {
                cloneArray[i] = testArray[i];
            }

            hc = HammingBase.EncodeByteArray(new byte[2] {
                0x1, 0x0
            });
            byte[] testArray2 = hc.GetHammingBytes();

            // Ensures that the testArray is just a copy of the Hamming Bytes. Not a reference
            Assert.IsTrue(cloneArray.Length == testArray.Length);
            for (int i = 0; i < cloneArray.Length; i++)
            {
                Assert.IsTrue(cloneArray[i] == testArray[i]);
            }

            Assert.IsFalse(testArray.Length == testArray2.Length);
        }
        public void SimulateNoErrorTest()
        {
            for (int byteSize = 1; byteSize < 16; byteSize++)
            {
                byte[] byteArray = createByteArray(byteSize);

                HammingBase hc = HammingBase.EncodeByteArray(byteArray); // encodes byte array

                // Simulate no error by doing nothing

                // builds and checks report
                HammingReport hr = hc.BuildReport();
                Assert.IsTrue(hr.Status == ErrorTypesEnum.NoError);
                Assert.IsTrue(hr.Syndrome == 0);

                // checks return value
                byte[] retrievedValue = hc.RetrieveValue() as byte[];
                Assert.IsNotNull(retrievedValue);
                Assert.IsTrue(retrievedValue.Length == byteArray.Length);
                for (int i = 0; i < byteArray.Length; i++)
                {
                    Assert.IsTrue(byteArray[i] == retrievedValue[i]);
                }
            }
        }
        public void SimulateSingleDataBitErrorTest()
        {
            for (int byteSize = 1; byteSize < 16; byteSize++)
            {
                byte[] byteArray = createByteArray(byteSize);

                HammingBase hc = HammingBase.EncodeByteArray(byteArray);  // encodes byte array

                // Simulate Master Bit Error
                hc.SimulateSingleDataBitError();

                // builds and checks report
                HammingReport hr = hc.BuildReport();
                Assert.IsTrue(hr.Status == ErrorTypesEnum.DataBitError);
                Assert.IsTrue(hr.Syndrome > 0);
                Assert.IsTrue(hr.Corrected); // Ensures HammingObject is corrected

                // checks return value
                byte[] retrievedValue = hc.RetrieveValue() as byte[];
                Assert.IsNotNull(retrievedValue);
                Assert.IsTrue(retrievedValue.Length == byteArray.Length);
                for (int i = 0; i < byteArray.Length; i++)
                {
                    Assert.IsTrue(byteArray[i] == retrievedValue[i]);
                }
            }
        }
        public void TestBytesArrayEncoding()
        {
            HammingBase hc = HammingBase.EncodeByteArray(test);

            byte[] testArray = hc.RetrieveValue() as byte[];

            Assert.IsNotNull(testArray);
            Assert.AreEqual(testArray.Length, test.Length);
            for (int i = 0; i < testArray.Length; i++)
            {
                Assert.IsTrue(test[i] == testArray[i]);
            }
        }