diff options
author | Lei Zhang <thestig@chromium.org> | 2017-04-24 17:34:35 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-25 16:36:24 +0000 |
commit | 49f8dc5b1afc4f92110bf40b7639ee1138aa7240 (patch) | |
tree | e3e85a069b03d1656d498523b172c95654c6570f /fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp | |
parent | ab1faaa7f81b7dafe03d546341c6a643a58b3678 (diff) | |
download | pdfium-49f8dc5b1afc4f92110bf40b7639ee1138aa7240.tar.xz |
Test more OnedCode128WriterTest methods.
Change-Id: Ifc6e98af8e9f8505edce8b04836fbe0d6ab5743d
Reviewed-on: https://pdfium-review.googlesource.com/4476
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp')
-rw-r--r-- | fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp b/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp index add4696a18..dc3a38f674 100644 --- a/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp +++ b/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp @@ -81,4 +81,48 @@ TEST(OnedCode128WriterTest, Encode128C) { } } +TEST(OnedCode128WriterTest, CheckContentValidity) { + { + CBC_OnedCode128Writer writer(BC_CODE128_B); + EXPECT_TRUE(writer.CheckContentValidity(L"")); + EXPECT_TRUE(writer.CheckContentValidity(L"foo")); + EXPECT_TRUE(writer.CheckContentValidity(L"xyz")); + EXPECT_FALSE(writer.CheckContentValidity(L"\"")); + EXPECT_FALSE(writer.CheckContentValidity(L"f\x10oo")); + EXPECT_FALSE(writer.CheckContentValidity(L"bar\x7F")); + EXPECT_FALSE(writer.CheckContentValidity(L"qux\x88")); + } + { + CBC_OnedCode128Writer writer(BC_CODE128_C); + EXPECT_TRUE(writer.CheckContentValidity(L"")); + EXPECT_TRUE(writer.CheckContentValidity(L"foo")); + EXPECT_TRUE(writer.CheckContentValidity(L"xyz")); + EXPECT_FALSE(writer.CheckContentValidity(L"\"")); + EXPECT_FALSE(writer.CheckContentValidity(L"f\x10oo")); + EXPECT_FALSE(writer.CheckContentValidity(L"bar\x7F")); + EXPECT_FALSE(writer.CheckContentValidity(L"qux\x88")); + } +} + +TEST(OnedCode128WriterTest, FilterContents) { + { + CBC_OnedCode128Writer writer(BC_CODE128_B); + EXPECT_STREQ(L"", writer.FilterContents(L"").c_str()); + EXPECT_STREQ(L"foo", writer.FilterContents(L"foo\x10").c_str()); + EXPECT_STREQ(L"fool", writer.FilterContents(L"foo\x10l").c_str()); + EXPECT_STREQ(L"foo", writer.FilterContents(L"foo\x10\x7F").c_str()); + EXPECT_STREQ(L"foo", writer.FilterContents(L"foo\x10\x7F\x88").c_str()); + EXPECT_STREQ(L"bar", writer.FilterContents(L"bar\x10\x7F\x88").c_str()); + } + { + CBC_OnedCode128Writer writer(BC_CODE128_C); + EXPECT_STREQ(L"", writer.FilterContents(L"").c_str()); + EXPECT_STREQ(L"f", writer.FilterContents(L"foo\x10").c_str()); + EXPECT_STREQ(L"f", writer.FilterContents(L"foo\x10l").c_str()); + EXPECT_STREQ(L"f", writer.FilterContents(L"foo\x10\x7F").c_str()); + EXPECT_STREQ(L"f", writer.FilterContents(L"foo\x10\x7F\x88").c_str()); + EXPECT_STREQ(L"ba", writer.FilterContents(L"bar\x10\x7F\x88").c_str()); + } +} + } // namespace |