From 3325a168dcefcee8f497a4f0a26016b475fb7a38 Mon Sep 17 00:00:00 2001 From: Raffael Herrmann Date: Fri, 19 Apr 2024 23:47:38 +0200 Subject: [PATCH] Fixed test case for byte-array data --- QRCoderTests/QRGeneratorTests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/QRCoderTests/QRGeneratorTests.cs b/QRCoderTests/QRGeneratorTests.cs index f8eec5fd..bbeeb91d 100644 --- a/QRCoderTests/QRGeneratorTests.cs +++ b/QRCoderTests/QRGeneratorTests.cs @@ -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"); } }