protobuf/conformance/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 "third_party/jsoncpp/json.h"
35 #include "conformance_test.h"
36 
37 namespace google {
38 namespace protobuf {
39 
40 class BinaryAndJsonConformanceSuite : public ConformanceTestSuite {
41  public:
43 
44  private:
45  void RunSuiteImpl() override;
46  void RunJsonTests();
53  void RunJsonTestsForStruct();
54  void RunJsonTestsForValue();
55  void RunJsonTestsForAny();
56  void RunValidJsonTest(const std::string& test_name, ConformanceLevel level,
57  const std::string& input_json,
58  const std::string& equivalent_text_format);
60  const std::string& test_name, ConformanceLevel level,
61  const protobuf_test_messages::proto3::TestAllTypesProto3& input,
62  const std::string& equivalent_text_format);
63  void RunValidJsonIgnoreUnknownTest(const std::string& test_name,
65  const std::string& input_json,
66  const std::string& equivalent_text_format);
67  void RunValidProtobufTest(const std::string& test_name,
69  const std::string& input_protobuf,
70  const std::string& equivalent_text_format,
71  bool is_proto3);
72  void RunValidBinaryProtobufTest(const std::string& test_name,
74  const std::string& input_protobuf,
75  bool is_proto3);
76  void RunValidBinaryProtobufTest(const std::string& test_name,
78  const std::string& input_protobuf,
79  const std::string& expected_protobuf,
80  bool is_proto3);
82  const std::string& test_name, ConformanceLevel level,
83  const Message* input, const std::string& equivalent_text_format,
84  bool is_proto3);
85 
86  bool ParseJsonResponse(
87  const conformance::ConformanceResponse& response,
88  Message* test_message);
89  bool ParseResponse(
90  const conformance::ConformanceResponse& response,
91  const ConformanceRequestSetting& setting,
92  Message* test_message) override;
93 
95  void RunValidJsonTestWithValidator(const std::string& test_name,
97  const std::string& input_json,
98  const Validator& validator,
99  bool is_proto3);
100  void ExpectParseFailureForJson(const std::string& test_name,
102  const std::string& input_json);
103  void ExpectSerializeFailureForJson(const std::string& test_name,
105  const std::string& text_format);
107  const std::string& test_name,
109  bool is_proto3);
110  void ExpectParseFailureForProto(const std::string& proto,
111  const std::string& test_name,
114  const std::string& test_name,
117  void TestIllegalTags();
118  template <class MessageType>
119  void TestOneofMessage (MessageType &message,
120  bool is_proto3);
121  template <class MessageType>
122  void TestUnknownMessage (MessageType &message,
123  bool is_proto3);
126  std::vector<std::pair<std::string, std::string>> values);
131  void TestMergeOneofMessage();
133 
134  std::unique_ptr<google::protobuf::util::TypeResolver> type_resolver_;
136 };
137 
138 } // namespace protobuf
139 } // namespace google
140 
141 #endif // CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H
google::protobuf::FieldDescriptor::Type
Type
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:521
google::protobuf::BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention
void RunJsonTestsForFieldNameConvention()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:1576
google::protobuf::BinaryAndJsonConformanceSuite::RunJsonTestsForAny
void RunJsonTestsForAny()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:2878
google::protobuf::BinaryAndJsonConformanceSuite::RunValidJsonIgnoreUnknownTest
void RunValidJsonIgnoreUnknownTest(const string &test_name, ConformanceLevel level, const string &input_json, const string &equivalent_text_format)
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:391
bool
bool
Definition: setup_once.h:312
google::protobuf::BinaryAndJsonConformanceSuite::type_resolver_
std::unique_ptr< google::protobuf::util::TypeResolver > type_resolver_
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.h:120
google::protobuf::ConformanceTestSuite::ConformanceLevel
ConformanceLevel
Definition: bloaty/third_party/protobuf/conformance/conformance_test.h:205
google::protobuf::BinaryAndJsonConformanceSuite::ExpectParseFailureForProtoWithProtoVersion
void ExpectParseFailureForProtoWithProtoVersion(const string &proto, const string &test_name, ConformanceLevel level, bool is_proto3)
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:319
google::protobuf::BinaryAndJsonConformanceSuite::BinaryAndJsonConformanceSuite
BinaryAndJsonConformanceSuite()
Definition: protobuf/conformance/binary_json_conformance_suite.h:42
google::protobuf::BinaryAndJsonConformanceSuite::ParseResponse
bool ParseResponse(const conformance::ConformanceResponse &response, const ConformanceRequestSetting &setting, Message *test_message) override
google::protobuf::BinaryAndJsonConformanceSuite::RunJsonTestsForRepeatedTypes
void RunJsonTestsForRepeatedTypes()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:2454
google::protobuf::BinaryAndJsonConformanceSuite::RunValidJsonTestWithProtobufInput
void RunValidJsonTestWithProtobufInput(const string &test_name, ConformanceLevel level, const protobuf_test_messages::proto3::TestAllTypesProto3 &input, const string &equivalent_text_format)
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
google::protobuf::BinaryAndJsonConformanceSuite::TestIllegalTags
void TestIllegalTags()
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:832
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
conformance_test.h
google::protobuf::BinaryAndJsonConformanceSuite::RunValidJsonTestWithValidator
void RunValidJsonTestWithValidator(const string &test_name, ConformanceLevel level, const string &input_json, const Validator &validator)
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:454
Validator
Definition: api_fuzzer.cc:272
google::protobuf::BinaryAndJsonConformanceSuite::TestValidDataForMapType
void TestValidDataForMapType(google::protobuf::FieldDescriptor::Type, google::protobuf::FieldDescriptor::Type)
Definition: protobuf/conformance/binary_json_conformance_suite.cc:940
google::protobuf::BinaryAndJsonConformanceSuite::RunJsonTestsForFieldMask
void RunJsonTestsForFieldMask()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:2782
google::protobuf::BinaryAndJsonConformanceSuite::TestOneofMessage
void TestOneofMessage(MessageType &message, bool is_proto3)
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:847
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
google::protobuf::BinaryAndJsonConformanceSuite::ExpectHardParseFailureForProto
void ExpectHardParseFailureForProto(const std::string &proto, const std::string &test_name, ConformanceLevel level)
google::protobuf::BinaryAndJsonConformanceSuite::RunJsonTestsForValue
void RunJsonTestsForValue()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:2816
google::protobuf::BinaryAndJsonConformanceSuite::type_url_
std::string type_url_
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.h:121
google::protobuf::BinaryAndJsonConformanceSuite::RunJsonTests
void RunJsonTests()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:1536
google::protobuf::BinaryAndJsonConformanceSuite::TestOverwriteMessageValueMap
void TestOverwriteMessageValueMap()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:1062
google::protobuf::BinaryAndJsonConformanceSuite::RunJsonTestsForStruct
void RunJsonTestsForStruct()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:2805
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: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:402
google::protobuf::BinaryAndJsonConformanceSuite::TestValidDataForRepeatedScalarMessage
void TestValidDataForRepeatedScalarMessage()
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:800
google::protobuf::BinaryAndJsonConformanceSuite::RunJsonTestsForNullTypes
void RunJsonTestsForNullTypes()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:2514
google::protobuf::BinaryAndJsonConformanceSuite::ExpectSerializeFailureForJson
void ExpectSerializeFailureForJson(const string &test_name, ConformanceLevel level, const string &text_format)
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:524
google::protobuf::BinaryAndJsonConformanceSuite::RunValidJsonTest
void RunValidJsonTest(const string &test_name, ConformanceLevel level, const string &input_json, const string &equivalent_text_format)
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:365
google::protobuf::Message
Definition: bloaty/third_party/protobuf/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)
google::protobuf::BinaryAndJsonConformanceSuite::ParseJsonResponse
bool ParseJsonResponse(const conformance::ConformanceResponse &response, Message *test_message)
google::protobuf::BinaryAndJsonConformanceSuite::RunJsonTestsForNonRepeatedTypes
void RunJsonTestsForNonRepeatedTypes()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:1725
asyncio_get_stats.response
response
Definition: asyncio_get_stats.py:28
google::protobuf::BinaryAndJsonConformanceSuite::Validator
std::function< bool(const Json::Value &)> Validator
Definition: protobuf/conformance/binary_json_conformance_suite.h:94
values
std::array< int64_t, Size > values
Definition: abseil-cpp/absl/container/btree_benchmark.cc:608
google::protobuf::BinaryAndJsonConformanceSuite::RunSuiteImpl
void RunSuiteImpl()
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:893
check_include_guards.validator
validator
Definition: check_include_guards.py:206
input
std::string input
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:197
google::protobuf::BinaryAndJsonConformanceSuite::TestValidDataForOneofType
void TestValidDataForOneofType(google::protobuf::FieldDescriptor::Type)
Definition: protobuf/conformance/binary_json_conformance_suite.cc:1099
google::protobuf::BinaryAndJsonConformanceSuite::TestUnknownMessage
void TestUnknownMessage(MessageType &message, bool is_proto3)
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:886
google::protobuf::BinaryAndJsonConformanceSuite::TestPrematureEOFForType
void TestPrematureEOFForType(google::protobuf::FieldDescriptor::Type type)
client.level
level
Definition: examples/python/async_streaming/client.py:118
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
google::protobuf::BinaryAndJsonConformanceSuite::RunValidBinaryProtobufTest
void RunValidBinaryProtobufTest(const string &test_name, ConformanceLevel level, const string &input_protobuf, bool is_proto3)
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:423
google::protobuf::BinaryAndJsonConformanceSuite::ExpectParseFailureForProto
void ExpectParseFailureForProto(const std::string &proto, const std::string &test_name, ConformanceLevel level)
google::protobuf::BinaryAndJsonConformanceSuite::ExpectParseFailureForJson
void ExpectParseFailureForJson(const string &test_name, ConformanceLevel level, const string &input_json)
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:498
function
std::function< bool(GrpcTool *, int, const char **, const CliCredentials &, GrpcToolOutputCallback)> function
Definition: grpc_tool.cc:250
google::protobuf::BinaryAndJsonConformanceSuite::RunJsonTestsForWrapperTypes
void RunJsonTestsForWrapperTypes()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:2538
google::protobuf::BinaryAndJsonConformanceSuite::RunValidProtobufTestWithMessage
void RunValidProtobufTestWithMessage(const string &test_name, ConformanceLevel level, const Message *input, const string &equivalent_text_format, bool is_proto3)
Definition: bloaty/third_party/protobuf/conformance/binary_json_conformance_suite.cc:442
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
google::protobuf::BinaryAndJsonConformanceSuite::TestMergeOneofMessage
void TestMergeOneofMessage()
Definition: protobuf/conformance/binary_json_conformance_suite.cc:1188
Json::Value
Represents a JSON value.
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:547


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:46