~bigbes/tarantool

tarantool-protobuf

ref: 0b6e1bc52ef675919ba245e012538e615d17afa1 tarantool-protobuf/examples/expected/runtime/conformance/conformance_pb.lua -rw-r--r-- 14.4 KiB
0b6e1bc5 — Eugene Blikh bench: add map_bench.lua, close ch2 (intervention regresses) 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
-- Code generated by protoc-gen-tarantool. DO NOT EDIT.
-- source: conformance.proto
-- syntax: proto3
-- package: conformance

local pb = require("pb")
local wire = pb.wire
local string_byte = string.byte
local utf8_len = require('utf8').len
local band = bit.band
local rshift = bit.rshift
local CHARS = wire.CHARS
local table_new = require('table.new')

local M = {}

M.options = {go_package = "tarantoolpb_synthetic/conformance", java_package = "com.google.protobuf.conformance", objc_class_prefix = "Conformance"}

-- Enum: conformance.WireFormat
M.WireFormat_descriptor = pb.enum("conformance.WireFormat", {
    UNSPECIFIED = 0,
    PROTOBUF = 1,
    JSON = 2,
    JSPB = 3,
    TEXT_FORMAT = 4,
})
M.WireFormat = M.WireFormat_descriptor.by_name

-- Enum: conformance.TestCategory
M.TestCategory_descriptor = pb.enum("conformance.TestCategory", {
    UNSPECIFIED_TEST = 0,
    BINARY_TEST = 1,
    JSON_TEST = 2,
    -- Similar to JSON_TEST. However, during parsing json, testee should ignore
    -- unknown fields. This feature is optional. Each implementation can decide
    -- whether to support it.  See
    -- https://developers.google.com/protocol-buffers/docs/proto3#json_options
    -- for more detail.
    JSON_IGNORE_UNKNOWN_PARSING_TEST = 3,
    -- Test jspb wire format. Only used inside Google. Opensource testees just
    -- skip it.
    JSPB_TEST = 4,
    -- Test text format. For cpp, java and python, testees can already deal with
    -- this type. Testees of other languages can simply skip it.
    TEXT_FORMAT_TEST = 5,
})
M.TestCategory = M.TestCategory_descriptor.by_name

-- Pre-declare message descriptors so cross-references resolve.
M.TestStatus_descriptor = {name = "conformance.TestStatus"}
M.FailureSet_descriptor = {name = "conformance.FailureSet"}
M.ConformanceRequest_descriptor = {name = "conformance.ConformanceRequest"}
M.ConformanceResponse_descriptor = {name = "conformance.ConformanceResponse"}
M.JspbEncodingConfig_descriptor = {name = "conformance.JspbEncodingConfig"}

-- Message: conformance.TestStatus
M.TestStatus_descriptor.fields = {
    {name="name", id=1, kind='scalar', proto_type="string"},
    {name="failure_message", id=2, kind='scalar', proto_type="string"},
    {name="matched_name", id=3, kind='scalar', proto_type="string"},
}
pb.finalize_message(M.TestStatus_descriptor)
M.TestStatus_fields = pb.field_names({
    name = "name",
    failure_message = "failure_message",
    matched_name = "matched_name",
})

-- Message: conformance.FailureSet
M.FailureSet_descriptor.fields = {
    {name="test", id=2, kind='message', message=M.TestStatus_descriptor, repeated=true},
}
pb.finalize_message(M.FailureSet_descriptor)
M.FailureSet_fields = pb.field_names({
    test = "test",
})

-- Message: conformance.ConformanceRequest
M.ConformanceRequest_descriptor.fields = {
    {name="protobuf_payload", id=1, kind='scalar', proto_type="bytes", oneof="payload"},
    {name="json_payload", id=2, kind='scalar', proto_type="string", oneof="payload"},
    {name="jspb_payload", id=7, kind='scalar', proto_type="string", oneof="payload"},
    {name="text_payload", id=8, kind='scalar', proto_type="string", oneof="payload"},
    {name="requested_output_format", id=3, kind='enum', enum=M.WireFormat_descriptor},
    {name="message_type", id=4, kind='scalar', proto_type="string"},
    {name="test_category", id=5, kind='enum', enum=M.TestCategory_descriptor},
    {name="jspb_encoding_options", id=6, kind='message', message=M.JspbEncodingConfig_descriptor},
    {name="print_unknown_fields", id=9, kind='scalar', proto_type="bool"},
}
M.ConformanceRequest_descriptor.oneofs = {
    payload = {"protobuf_payload", "json_payload", "jspb_payload", "text_payload"},
}
pb.finalize_message(M.ConformanceRequest_descriptor)
M.ConformanceRequest_fields = pb.field_names({
    protobuf_payload = "protobuf_payload",
    json_payload = "json_payload",
    jspb_payload = "jspb_payload",
    text_payload = "text_payload",
    requested_output_format = "requested_output_format",
    message_type = "message_type",
    test_category = "test_category",
    jspb_encoding_options = "jspb_encoding_options",
    print_unknown_fields = "print_unknown_fields",
})
M.ConformanceRequest_oneofs = pb.field_names({
    payload = "payload",
})

-- Message: conformance.ConformanceResponse
M.ConformanceResponse_descriptor.fields = {
    {name="parse_error", id=1, kind='scalar', proto_type="string", oneof="result"},
    {name="serialize_error", id=6, kind='scalar', proto_type="string", oneof="result"},
    {name="timeout_error", id=9, kind='scalar', proto_type="string", oneof="result"},
    {name="runtime_error", id=2, kind='scalar', proto_type="string", oneof="result"},
    {name="protobuf_payload", id=3, kind='scalar', proto_type="bytes", oneof="result"},
    {name="json_payload", id=4, kind='scalar', proto_type="string", oneof="result"},
    {name="skipped", id=5, kind='scalar', proto_type="string", oneof="result"},
    {name="jspb_payload", id=7, kind='scalar', proto_type="string", oneof="result"},
    {name="text_payload", id=8, kind='scalar', proto_type="string", oneof="result"},
}
M.ConformanceResponse_descriptor.oneofs = {
    result = {"parse_error", "serialize_error", "timeout_error", "runtime_error", "protobuf_payload", "json_payload", "skipped", "jspb_payload", "text_payload"},
}
pb.finalize_message(M.ConformanceResponse_descriptor)
M.ConformanceResponse_fields = pb.field_names({
    parse_error = "parse_error",
    serialize_error = "serialize_error",
    timeout_error = "timeout_error",
    runtime_error = "runtime_error",
    protobuf_payload = "protobuf_payload",
    json_payload = "json_payload",
    skipped = "skipped",
    jspb_payload = "jspb_payload",
    text_payload = "text_payload",
})
M.ConformanceResponse_oneofs = pb.field_names({
    result = "result",
})

-- Message: conformance.JspbEncodingConfig
M.JspbEncodingConfig_descriptor.fields = {
    {name="use_jspb_array_any_format", id=1, kind='scalar', proto_type="bool"},
}
pb.finalize_message(M.JspbEncodingConfig_descriptor)
M.JspbEncodingConfig_fields = pb.field_names({
    use_jspb_array_any_format = "use_jspb_array_any_format",
})

-- EmmyLua / lua-language-server type annotations.
-- These are comments — no runtime effect. They give editors
-- autocomplete and type-checking for the generated wrappers.
---@alias conformance.WireFormat integer
---@alias conformance.TestCategory integer

--- Meant to encapsulate all types of tests: successes, skips, failures, etc.
--- Therefore, this may or may not have a failure message. Failure messages
--- may be truncated for our failure lists.
---@class conformance.TestStatus
---@field name string
---@field failure_message string
---@field matched_name string @ What an actual test name matched to in a failure list. Can be wildcarded or an exact match without wildcards.

--- The conformance runner will request a list of failures as the first request.
--- This will be known by message_type == "conformance.FailureSet", a conformance
--- test should return a serialized FailureSet in protobuf_payload.
---@class conformance.FailureSet
---@field test conformance.TestStatus[]

--- Represents a single test case's input.  The testee should:
---
---   1. parse this proto (which should always succeed)
---   2. parse the protobuf or JSON payload in "payload" (which may fail)
---   3. if the parse succeeded, serialize the message in the requested format.
---@class conformance.ConformanceRequest
---@field protobuf_payload? string
---@field json_payload? string
---@field jspb_payload? string @ Only used inside Google.  Opensource testees just skip it.
---@field text_payload? string
---@field requested_output_format conformance.WireFormat @ Which format should the testee serialize its message to?
---@field message_type string @ The full name for the test message to use; for the moment, either: protobuf_test_messages.proto3.TestAllTypesProto3 or protobuf_test_messages.proto2.TestAllTypesProto2 or protobuf_test_messages.editions.proto2.TestAllTypesProto2 or protobuf_test_messages.editions.proto3.TestAllTypesProto3 or protobuf_test_messages.editions.TestAllTypesEdition2023 or protobuf_test_messages.edition_unstable.TestAllTypesEditionUnstable.
---@field test_category conformance.TestCategory @ Each test is given a specific test category. Some category may need specific support in testee programs. Refer to the definition of TestCategory for more information.
---@field jspb_encoding_options conformance.JspbEncodingConfig @ Specify details for how to encode jspb.
---@field print_unknown_fields boolean @ This can be used in json and text format. If true, testee should print unknown fields instead of ignore. This feature is optional.

--- Represents a single test case's output.
---@class conformance.ConformanceResponse
---@field parse_error? string @ This string should be set to indicate parsing failed.  The string can provide more information about the parse error if it is available.  Setting this string does not necessarily mean the testee failed the test.  Some of the test cases are intentionally invalid input.
---@field serialize_error? string @ If the input was successfully parsed but errors occurred when serializing it to the requested output format, set the error message in this field.
---@field timeout_error? string @ This should be set if the test program timed out.  The string should provide more information about what the child process was doing when it was killed.
---@field runtime_error? string @ This should be set if some other error occurred.  This will always indicate that the test failed.  The string can provide more information about the failure.
---@field protobuf_payload? string @ If the input was successfully parsed and the requested output was protobuf, serialize it to protobuf and set it in this field.
---@field json_payload? string @ If the input was successfully parsed and the requested output was JSON, serialize to JSON and set it in this field.
---@field skipped? string @ For when the testee skipped the test, likely because a certain feature wasn't supported, like JSON input/output.
---@field jspb_payload? string @ If the input was successfully parsed and the requested output was JSPB, serialize to JSPB and set it in this field. JSPB is only used inside Google. Opensource testees can just skip it.
---@field text_payload? string @ If the input was successfully parsed and the requested output was TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field.

--- Encoding options for jspb format.
---@class conformance.JspbEncodingConfig
---@field use_jspb_array_any_format boolean @ Encode the value field of Any as jspb array if true, otherwise binary.

---@param t? conformance.TestStatus
---@return conformance.TestStatus
function M.TestStatus_new(t) return t or {} end
---@param t conformance.TestStatus
---@return string
function M.TestStatus_encode(t) return pb.encode(M.TestStatus_descriptor, t) end
---@param b string
---@return conformance.TestStatus
function M.TestStatus_decode(b) return pb.decode(M.TestStatus_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.TestStatus_decode_lazy(b) return pb.decode_lazy(M.TestStatus_descriptor, b) end
---@param t conformance.TestStatus
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.TestStatus_text(t, opts) return pb.text.encode(M.TestStatus_descriptor, t, opts) end

---@param t? conformance.FailureSet
---@return conformance.FailureSet
function M.FailureSet_new(t) return t or {} end
---@param t conformance.FailureSet
---@return string
function M.FailureSet_encode(t) return pb.encode(M.FailureSet_descriptor, t) end
---@param b string
---@return conformance.FailureSet
function M.FailureSet_decode(b) return pb.decode(M.FailureSet_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.FailureSet_decode_lazy(b) return pb.decode_lazy(M.FailureSet_descriptor, b) end
---@param t conformance.FailureSet
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.FailureSet_text(t, opts) return pb.text.encode(M.FailureSet_descriptor, t, opts) end

---@param t? conformance.ConformanceRequest
---@return conformance.ConformanceRequest
function M.ConformanceRequest_new(t) return t or {} end
---@param t conformance.ConformanceRequest
---@return string
function M.ConformanceRequest_encode(t) return pb.encode(M.ConformanceRequest_descriptor, t) end
---@param b string
---@return conformance.ConformanceRequest
function M.ConformanceRequest_decode(b) return pb.decode(M.ConformanceRequest_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.ConformanceRequest_decode_lazy(b) return pb.decode_lazy(M.ConformanceRequest_descriptor, b) end
---@param t conformance.ConformanceRequest
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.ConformanceRequest_text(t, opts) return pb.text.encode(M.ConformanceRequest_descriptor, t, opts) end

---@param t? conformance.ConformanceResponse
---@return conformance.ConformanceResponse
function M.ConformanceResponse_new(t) return t or {} end
---@param t conformance.ConformanceResponse
---@return string
function M.ConformanceResponse_encode(t) return pb.encode(M.ConformanceResponse_descriptor, t) end
---@param b string
---@return conformance.ConformanceResponse
function M.ConformanceResponse_decode(b) return pb.decode(M.ConformanceResponse_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.ConformanceResponse_decode_lazy(b) return pb.decode_lazy(M.ConformanceResponse_descriptor, b) end
---@param t conformance.ConformanceResponse
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.ConformanceResponse_text(t, opts) return pb.text.encode(M.ConformanceResponse_descriptor, t, opts) end

---@param t? conformance.JspbEncodingConfig
---@return conformance.JspbEncodingConfig
function M.JspbEncodingConfig_new(t) return t or {} end
---@param t conformance.JspbEncodingConfig
---@return string
function M.JspbEncodingConfig_encode(t) return pb.encode(M.JspbEncodingConfig_descriptor, t) end
---@param b string
---@return conformance.JspbEncodingConfig
function M.JspbEncodingConfig_decode(b) return pb.decode(M.JspbEncodingConfig_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.JspbEncodingConfig_decode_lazy(b) return pb.decode_lazy(M.JspbEncodingConfig_descriptor, b) end
---@param t conformance.JspbEncodingConfig
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.JspbEncodingConfig_text(t, opts) return pb.text.encode(M.JspbEncodingConfig_descriptor, t, opts) end

return M