You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
944 B
43 lines
944 B
/* |
|
* Copyright 2022 gitlost |
|
*/ |
|
// SPDX-License-Identifier: Apache-2.0 |
|
|
|
#include "DecoderResult.h" |
|
#include "pdf417/PDFScanningDecoder.h" |
|
|
|
#include "gtest/gtest.h" |
|
|
|
using namespace ZXing; |
|
using namespace ZXing::Pdf417; |
|
|
|
TEST(PDF417ScanningDecoderTest, BadSymbolLengthDescriptor) |
|
{ |
|
{ |
|
std::vector<int> codewords = { 4, 1, 449, 394 }; // 4 should be 2 |
|
|
|
auto result = DecodeCodewords(codewords, 2); |
|
|
|
EXPECT_TRUE(result.isValid()); |
|
EXPECT_EQ(result.text(), L"AB"); |
|
EXPECT_EQ(codewords[0], 2); |
|
} |
|
{ |
|
std::vector<int> codewords = { 1, 1, 800, 351 }; // 1 should be 2 |
|
|
|
auto result = DecodeCodewords(codewords, 2); |
|
|
|
EXPECT_TRUE(result.isValid()); |
|
EXPECT_EQ(result.text(), L"AB"); |
|
EXPECT_EQ(codewords[0], 2); |
|
} |
|
{ |
|
std::vector<int> codewords = { 0, 1, 917, 27 }; // 0 should be 2 |
|
|
|
auto result = DecodeCodewords(codewords, 2); |
|
|
|
EXPECT_TRUE(result.isValid()); |
|
EXPECT_EQ(result.text(), L"AB"); |
|
EXPECT_EQ(codewords[0], 2); |
|
} |
|
}
|
|
|