Skip to content

Commit

Permalink
Fixed test case for byte-array data
Browse files Browse the repository at this point in the history
  • Loading branch information
codebude committed Apr 19, 2024
1 parent e671274 commit 3325a16
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions QRCoderTests/QRGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ public void can_encode_byte()
[Category("QRGenerator/TextEncoding")]
public void can_generate_from_bytes()
{
byte[] test_data = { 49, 50, 51, 65, 66, 67 }; //123ABC
var gen = new QRCodeGenerator();
var qrData = gen.CreateQrCode(Encoding.UTF8.GetBytes("123ABC"), QRCodeGenerator.ECCLevel.L);
var qrData = gen.CreateQrCode(test_data, QRCodeGenerator.ECCLevel.L);
var result = string.Join("", qrData.ModuleMatrix.Select(x => x.ToBitString()).ToArray());
result.ShouldBe("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111010111011111110000000010000010001100100000100000000101110101101001011101000000001011101011001010111010000000010111010100100101110100000000100000100111101000001000000001111111010101011111110000000000000000000110000000000000000111100101111110011101000000000111100010011110001110000000000100010100100000001000000000011110011111001110011000000001111101110101001000000000000000000000111100100100100000000111111100001100100110000000001000001000100001111110000000010111010010011111010100000000101110101111001011110000000001011101010101011000000000000010000010111001000010000000000111111101010010010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
result.ShouldBe("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111011001011111110000000010000010010010100000100000000101110101010101011101000000001011101010010010111010000000010111010111000101110100000000100000100000001000001000000001111111010101011111110000000000000000011000000000000000000111100101010010011101000000001011100001001001001110000000010101011111011111110100000000000101000000110000000000000001011001001010100110000000000000000000110001000101000000000111111100110011011110000000001000001001111110111010000000010111010011100100101100000000101110101110010010010000000001011101011010100011000000000010000010110110101000100000000111111101011100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
}
}

Expand Down

0 comments on commit 3325a16

Please sign in to comment.