5#include "fxbarcode/oned/BC_OnedCodaBarWriter.h"
9#include "core/fxcrt/compiler_specific.h"
10#include "core/fxcrt/data_vector.h"
11#include "testing/gtest/include/gtest/gtest.h"
15TEST(OnedCodaBarWriterTest, Encode) {
16 CBC_OnedCodaBarWriter writer;
18 static const char kExpected1[] =
21 DataVector<uint8_t> encoded = writer.Encode(
"");
22 ASSERT_EQ(strlen(kExpected1), encoded.size());
23 for (size_t i = 0; i < strlen(kExpected1); i++) {
24 UNSAFE_TODO(EXPECT_EQ(kExpected1[i] !=
' ', !!encoded[i])) << i;
26 static const char kExpected2[] =
32 encoded = writer.Encode(
"123");
33 ASSERT_EQ(strlen(kExpected2), encoded.size());
34 for (size_t i = 0; i < strlen(kExpected2); i++) {
35 UNSAFE_TODO(EXPECT_EQ(kExpected2[i] !=
' ', !!encoded[i])) << i;
37 static const char kExpected3[] =
46 encoded = writer.Encode(
"-$./:+");
47 ASSERT_EQ(strlen(kExpected3), encoded.size());
48 for (size_t i = 0; i < strlen(kExpected3); i++) {
49 UNSAFE_TODO(EXPECT_EQ(kExpected3[i] !=
' ', !!encoded[i])) << i;
51 static const char kExpected4[] =
71 encoded = writer.Encode(
"456.987987987/001");
72 ASSERT_EQ(strlen(kExpected4), encoded.size());
73 for (size_t i = 0; i < strlen(kExpected4); i++) {
74 UNSAFE_TODO(EXPECT_EQ(kExpected4[i] !=
' ', !!encoded[i])) << i;
78TEST(OnedCodaBarWriterTest, SetDelimiters) {
79 CBC_OnedCodaBarWriter writer;
110 static const char kExpected[] =
116 DataVector<uint8_t> encoded = writer.Encode(
"987");
117 ASSERT_EQ(strlen(kExpected), encoded.size());
118 for (size_t i = 0; i < strlen(kExpected); i++) {
119 UNSAFE_TODO(EXPECT_EQ(kExpected[i] !=
' ', !!encoded[i])) << i;
bool SetEndChar(char end) override
bool SetStartChar(char start) override