void AlphanumericEncoding() { QrSegment segment = QrSegment.MakeAlphanumeric(TextAlphanumeric); Assert.Equal(segment.EncodingMode, QrSegment.Mode.Alphanumeric); Assert.Equal(TextAlphanumeric.Length, segment.NumChars); BitArray data = segment.GetData(); Assert.Equal(BitLengthAlphanumeric, data.Length); Assert.Equal(BitsAlphanumeric, BitArrayToByteArray(data)); }
void Utf8Encoding() { List <QrSegment> segments = QrSegment.MakeSegments(TextUtf8); Assert.Single(segments); QrSegment segment = segments[0]; Assert.Equal(segment.EncodingMode, QrSegment.Mode.Byte); Assert.Equal(Encoding.UTF8.GetBytes(TextUtf8).Length, segment.NumChars); BitArray data = segment.GetData(); Assert.Equal(BitLengthUtf8, data.Length); Assert.Equal(BitsUtf8, BitArrayToByteArray(data)); }
void AutoAlphanumericEncoding() { List <QrSegment> segments = QrSegment.MakeSegments(TextAlphanumeric); Assert.Single(segments); QrSegment segment = segments[0]; Assert.Equal(segment.EncodingMode, QrSegment.Mode.Alphanumeric); Assert.Equal(TextAlphanumeric.Length, segment.NumChars); BitArray data = segment.GetData(); Assert.Equal(BitLengthAlphanumeric, data.Length); Assert.Equal(BitsAlphanumeric, BitArrayToByteArray(data)); }