OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" | 5 #include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" | 9 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" |
10 #include "core/fxcrt/include/fx_basic.h" | 10 #include "core/fxcrt/fx_basic.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "testing/test_support.h" | 12 #include "testing/test_support.h" |
13 | 13 |
14 TEST(SimpleParserTest, GetWord) { | 14 TEST(SimpleParserTest, GetWord) { |
15 pdfium::StrFuncTestData test_data[] = { | 15 pdfium::StrFuncTestData test_data[] = { |
16 // Empty src string. | 16 // Empty src string. |
17 STR_IN_OUT_CASE("", ""), | 17 STR_IN_OUT_CASE("", ""), |
18 // Content with whitespaces only. | 18 // Content with whitespaces only. |
19 STR_IN_OUT_CASE(" \t \0 \n", ""), | 19 STR_IN_OUT_CASE(" \t \0 \n", ""), |
20 // Content with comments only. | 20 // Content with comments only. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 }; | 87 }; |
88 for (size_t i = 0; i < FX_ArraySize(test_data); ++i) { | 88 for (size_t i = 0; i < FX_ArraySize(test_data); ++i) { |
89 const FindTagTestStruct& data = test_data[i]; | 89 const FindTagTestStruct& data = test_data[i]; |
90 CPDF_SimpleParser parser(data.input, data.input_size); | 90 CPDF_SimpleParser parser(data.input, data.input_size); |
91 EXPECT_EQ(data.result, | 91 EXPECT_EQ(data.result, |
92 parser.FindTagParamFromStart(data.token, data.num_params)) | 92 parser.FindTagParamFromStart(data.token, data.num_params)) |
93 << " for case " << i; | 93 << " for case " << i; |
94 EXPECT_EQ(data.result_pos, parser.GetCurPos()) << " for case " << i; | 94 EXPECT_EQ(data.result_pos, parser.GetCurPos()) << " for case " << i; |
95 } | 95 } |
96 } | 96 } |
OLD | NEW |