public void testDecodeWithMisread() { FormatInformation expected = FormatInformation.decodeFormatInformation(MASKED_TEST_FORMAT_INFO, MASKED_TEST_FORMAT_INFO); Assert.AreEqual(expected, FormatInformation.decodeFormatInformation( MASKED_TEST_FORMAT_INFO ^ 0x03, MASKED_TEST_FORMAT_INFO ^ 0x0F)); }
public void testDecode() { // Normal case FormatInformation expected = FormatInformation.decodeFormatInformation(MASKED_TEST_FORMAT_INFO, MASKED_TEST_FORMAT_INFO); Assert.IsNotNull(expected); Assert.AreEqual((byte)0x07, expected.DataMask); Assert.AreEqual(ErrorCorrectionLevel.Q, expected.ErrorCorrectionLevel); // where the code forgot the mask! Assert.AreEqual(expected, FormatInformation.decodeFormatInformation(UNMASKED_TEST_FORMAT_INFO, MASKED_TEST_FORMAT_INFO)); }
public void testDecodeWithBitDifference() { FormatInformation expected = FormatInformation.decodeFormatInformation(MASKED_TEST_FORMAT_INFO, MASKED_TEST_FORMAT_INFO); // 1,2,3,4 bits difference Assert.AreEqual(expected, FormatInformation.decodeFormatInformation( MASKED_TEST_FORMAT_INFO ^ 0x01, MASKED_TEST_FORMAT_INFO ^ 0x01)); Assert.AreEqual(expected, FormatInformation.decodeFormatInformation( MASKED_TEST_FORMAT_INFO ^ 0x03, MASKED_TEST_FORMAT_INFO ^ 0x03)); Assert.AreEqual(expected, FormatInformation.decodeFormatInformation( MASKED_TEST_FORMAT_INFO ^ 0x07, MASKED_TEST_FORMAT_INFO ^ 0x07)); Assert.IsNull(FormatInformation.decodeFormatInformation( MASKED_TEST_FORMAT_INFO ^ 0x0F, MASKED_TEST_FORMAT_INFO ^ 0x0F)); }