binary_json_conformance_suite.h
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #ifndef CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H
32 #define CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H
33 
34 #include "conformance_test.h"
36 
37 namespace google {
38 namespace protobuf {
39 
41  public:
43 
44  private:
45  void RunSuiteImpl();
46  void RunValidJsonTest(const string& test_name,
48  const string& input_json,
49  const string& equivalent_text_format);
51  const string& test_name,
53  const protobuf_test_messages::proto3::TestAllTypesProto3& input,
54  const string& equivalent_text_format);
56  const string& test_name, ConformanceLevel level, const string& input_json,
57  const string& equivalent_text_format);
58  void RunValidProtobufTest(const string& test_name, ConformanceLevel level,
59  const string& input_protobuf,
60  const string& equivalent_text_format,
61  bool is_proto3);
62  void RunValidBinaryProtobufTest(const string& test_name,
64  const string& input_protobuf,
65  bool is_proto3);
67  const string& test_name, ConformanceLevel level,
68  const Message *input,
69  const string& equivalent_text_format,
70  bool is_proto3);
71 
72  bool ParseJsonResponse(
73  const conformance::ConformanceResponse& response,
74  Message* test_message);
75  bool ParseResponse(
76  const conformance::ConformanceResponse& response,
77  const ConformanceRequestSetting& setting,
78  Message* test_message) override;
79 
80  typedef std::function<bool(const Json::Value&)> Validator;
81  void RunValidJsonTestWithValidator(const string& test_name,
83  const string& input_json,
84  const Validator& validator);
85  void ExpectParseFailureForJson(const string& test_name,
87  const string& input_json);
88  void ExpectSerializeFailureForJson(const string& test_name,
90  const string& text_format);
91  void ExpectParseFailureForProtoWithProtoVersion (const string& proto,
92  const string& test_name,
94  bool is_proto3);
95  void ExpectParseFailureForProto(const std::string& proto,
96  const std::string& test_name,
99  const std::string& test_name,
102  void TestIllegalTags();
103  template <class MessageType>
104  void TestOneofMessage (MessageType &message,
105  bool is_proto3);
106  template <class MessageType>
107  void TestUnknownMessage (MessageType &message,
108  bool is_proto3);
111  std::vector<std::pair<std::string, std::string>> values);
112 
113  std::unique_ptr<google::protobuf::util::TypeResolver>
116 };
117 
118 } // namespace protobuf
119 } // namespace google
120 
121 #endif // CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H
google::protobuf::FieldDescriptor::Type
Type
Definition: src/google/protobuf/descriptor.h:521
google::protobuf::ConformanceTestSuite
Definition: conformance_test.h:141
google::protobuf::BinaryAndJsonConformanceSuite::RunValidJsonIgnoreUnknownTest
void RunValidJsonIgnoreUnknownTest(const string &test_name, ConformanceLevel level, const string &input_json, const string &equivalent_text_format)
Definition: binary_json_conformance_suite.cc:343
google::protobuf::ConformanceTestSuite::ConformanceLevel
ConformanceLevel
Definition: conformance_test.h:197
google::protobuf::BinaryAndJsonConformanceSuite::ExpectParseFailureForProtoWithProtoVersion
void ExpectParseFailureForProtoWithProtoVersion(const string &proto, const string &test_name, ConformanceLevel level, bool is_proto3)
Definition: binary_json_conformance_suite.cc:271
google::protobuf::BinaryAndJsonConformanceSuite::BinaryAndJsonConformanceSuite
BinaryAndJsonConformanceSuite()
Definition: binary_json_conformance_suite.h:42
input
std::string input
Definition: tokenizer_unittest.cc:197
google::protobuf::BinaryAndJsonConformanceSuite::ParseResponse
bool ParseResponse(const conformance::ConformanceResponse &response, const ConformanceRequestSetting &setting, Message *test_message) override
Definition: binary_json_conformance_suite.cc:217
google::protobuf::BinaryAndJsonConformanceSuite::RunValidJsonTestWithProtobufInput
void RunValidJsonTestWithProtobufInput(const string &test_name, ConformanceLevel level, const protobuf_test_messages::proto3::TestAllTypesProto3 &input, const string &equivalent_text_format)
Definition: binary_json_conformance_suite.cc:333
google::protobuf::BinaryAndJsonConformanceSuite::TestIllegalTags
void TestIllegalTags()
Definition: binary_json_conformance_suite.cc:622
google::protobuf::BinaryAndJsonConformanceSuite::RunValidJsonTestWithValidator
void RunValidJsonTestWithValidator(const string &test_name, ConformanceLevel level, const string &input_json, const Validator &validator)
Definition: binary_json_conformance_suite.cc:398
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
google::protobuf::BinaryAndJsonConformanceSuite::TestOneofMessage
void TestOneofMessage(MessageType &message, bool is_proto3)
Definition: binary_json_conformance_suite.cc:637
google::protobuf::BinaryAndJsonConformanceSuite::ExpectHardParseFailureForProto
void ExpectHardParseFailureForProto(const std::string &proto, const std::string &test_name, ConformanceLevel level)
Definition: binary_json_conformance_suite.cc:312
google::protobuf::BinaryAndJsonConformanceSuite::type_url_
std::string type_url_
Definition: binary_json_conformance_suite.h:115
values
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:3591
google::protobuf::BinaryAndJsonConformanceSuite::RunValidProtobufTest
void RunValidProtobufTest(const string &test_name, ConformanceLevel level, const string &input_protobuf, const string &equivalent_text_format, bool is_proto3)
Definition: binary_json_conformance_suite.cc:354
google::protobuf::BinaryAndJsonConformanceSuite::ExpectSerializeFailureForJson
void ExpectSerializeFailureForJson(const string &test_name, ConformanceLevel level, const string &text_format)
Definition: binary_json_conformance_suite.cc:468
type
GLenum type
Definition: glcorearb.h:2695
google::protobuf::BinaryAndJsonConformanceSuite::RunValidJsonTest
void RunValidJsonTest(const string &test_name, ConformanceLevel level, const string &input_json, const string &equivalent_text_format)
Definition: binary_json_conformance_suite.cc:317
google::protobuf::Message
Definition: src/google/protobuf/message.h:205
google::protobuf::BinaryAndJsonConformanceSuite::TestValidDataForType
void TestValidDataForType(google::protobuf::FieldDescriptor::Type, std::vector< std::pair< std::string, std::string >> values)
Definition: binary_json_conformance_suite.cc:586
google::protobuf::BinaryAndJsonConformanceSuite::ParseJsonResponse
bool ParseJsonResponse(const conformance::ConformanceResponse &response, Message *test_message)
Definition: binary_json_conformance_suite.cc:195
google::protobuf::BinaryAndJsonConformanceSuite::Validator
std::function< bool(const Json::Value &)> Validator
Definition: binary_json_conformance_suite.h:80
google::protobuf::BinaryAndJsonConformanceSuite::RunSuiteImpl
void RunSuiteImpl()
Definition: binary_json_conformance_suite.cc:683
json.h
google::protobuf::BinaryAndJsonConformanceSuite::type_resolver_
std::unique_ptr< google::protobuf::util::TypeResolver > type_resolver_
Definition: binary_json_conformance_suite.h:114
google::protobuf::BinaryAndJsonConformanceSuite::TestUnknownMessage
void TestUnknownMessage(MessageType &message, bool is_proto3)
Definition: binary_json_conformance_suite.cc:676
google::protobuf::BinaryAndJsonConformanceSuite::TestPrematureEOFForType
void TestPrematureEOFForType(google::protobuf::FieldDescriptor::Type type)
Definition: binary_json_conformance_suite.cc:498
google::protobuf::BinaryAndJsonConformanceSuite::RunValidBinaryProtobufTest
void RunValidBinaryProtobufTest(const string &test_name, ConformanceLevel level, const string &input_protobuf, bool is_proto3)
Definition: binary_json_conformance_suite.cc:375
google::protobuf::BinaryAndJsonConformanceSuite::ExpectParseFailureForProto
void ExpectParseFailureForProto(const std::string &proto, const std::string &test_name, ConformanceLevel level)
Definition: binary_json_conformance_suite.cc:301
google::protobuf::BinaryAndJsonConformanceSuite::ExpectParseFailureForJson
void ExpectParseFailureForJson(const string &test_name, ConformanceLevel level, const string &input_json)
Definition: binary_json_conformance_suite.cc:442
level
GLint level
Definition: glcorearb.h:2773
conformance_test.h
google::protobuf::BinaryAndJsonConformanceSuite::RunValidProtobufTestWithMessage
void RunValidProtobufTestWithMessage(const string &test_name, ConformanceLevel level, const Message *input, const string &equivalent_text_format, bool is_proto3)
Definition: binary_json_conformance_suite.cc:386
google
Definition: data_proto2_to_proto3_util.h:11
message
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glcorearb.h:2695
google::protobuf::BinaryAndJsonConformanceSuite
Definition: binary_json_conformance_suite.h:40
Json::Value
Represents a JSON value.
Definition: json.h:547


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:48