-- 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 M = {}
-- 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,
JSON_IGNORE_UNKNOWN_PARSING_TEST = 3,
JSPB_TEST = 4,
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)
-- 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)
-- 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)
-- 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)
-- 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)
function M.TestStatus_new(t) return t or {} end
function M.TestStatus_encode(t)
if type(t) ~= 'table' then
error("expected table for conformance.TestStatus, got " .. type(t), 0)
end
local out, n = {}, 0
local v
-- field 1: name
v = t.name
if v ~= nil and v ~= '' then
n = n + 1; out[n] = "\x0a"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 2: failure_message
v = t.failure_message
if v ~= nil and v ~= '' then
n = n + 1; out[n] = "\x12"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 3: matched_name
v = t.matched_name
if v ~= nil and v ~= '' then
n = n + 1; out[n] = "\x1a"
n = n + 1; out[n] = wire.encode_string(v)
end
local _uf = t._unknown_fields
if _uf ~= nil and _uf ~= '' then n = n + 1; out[n] = _uf end
return table.concat(out)
end
function M.TestStatus_decode(buf)
if type(buf) ~= 'string' then
error("expected string for conformance.TestStatus decode, got " .. type(buf), 0)
end
local result = {}
local pos, len = 1, #buf
local _uf
while pos <= len do
local _tag_start = pos
local id, wt
id, wt, pos = wire.decode_tag(buf, pos)
if id == 1 then
local val
val, pos = wire.decode_string(buf, pos)
result.name = val
elseif id == 2 then
local val
val, pos = wire.decode_string(buf, pos)
result.failure_message = val
elseif id == 3 then
local val
val, pos = wire.decode_string(buf, pos)
result.matched_name = val
else
pos = wire.skip_field(buf, pos, wt)
if _uf == nil then _uf = {} end
_uf[#_uf + 1] = buf:sub(_tag_start, pos - 1)
end
end
if _uf ~= nil then result._unknown_fields = table.concat(_uf) end
return result
end
function M.TestStatus_decode_lazy(b) return pb.decode_lazy(M.TestStatus_descriptor, b) end
function M.FailureSet_new(t) return t or {} end
function M.FailureSet_encode(t)
if type(t) ~= 'table' then
error("expected table for conformance.FailureSet, got " .. type(t), 0)
end
local out, n = {}, 0
local v
-- field 2: test
v = t.test
if v ~= nil and #v > 0 then
local _tag = "\x12"
for _i = 1, #v do
n = n + 1; out[n] = _tag
n = n + 1; out[n] = wire.encode_len(M.TestStatus_encode(v[_i]))
end
end
local _uf = t._unknown_fields
if _uf ~= nil and _uf ~= '' then n = n + 1; out[n] = _uf end
return table.concat(out)
end
function M.FailureSet_decode(buf)
if type(buf) ~= 'string' then
error("expected string for conformance.FailureSet decode, got " .. type(buf), 0)
end
local result = {}
local pos, len = 1, #buf
local _uf
while pos <= len do
local _tag_start = pos
local id, wt
id, wt, pos = wire.decode_tag(buf, pos)
if id == 2 then
local list = result.test
if list == nil then list = {}; result.test = list end
local payload
payload, pos = wire.decode_len(buf, pos)
list[#list + 1] = M.TestStatus_decode(payload)
else
pos = wire.skip_field(buf, pos, wt)
if _uf == nil then _uf = {} end
_uf[#_uf + 1] = buf:sub(_tag_start, pos - 1)
end
end
if _uf ~= nil then result._unknown_fields = table.concat(_uf) end
return result
end
function M.FailureSet_decode_lazy(b) return pb.decode_lazy(M.FailureSet_descriptor, b) end
function M.ConformanceRequest_new(t) return t or {} end
function M.ConformanceRequest_encode(t)
if type(t) ~= 'table' then
error("expected table for conformance.ConformanceRequest, got " .. type(t), 0)
end
local out, n = {}, 0
local v
local _of_payload
if t.protobuf_payload ~= nil then _of_payload = "protobuf_payload" end
if t.json_payload ~= nil then _of_payload = "json_payload" end
if t.jspb_payload ~= nil then _of_payload = "jspb_payload" end
if t.text_payload ~= nil then _of_payload = "text_payload" end
-- field 1: protobuf_payload
v = t.protobuf_payload
if _of_payload == "protobuf_payload" then
n = n + 1; out[n] = "\x0a"
n = n + 1; out[n] = wire.encode_bytes(v)
end
-- field 2: json_payload
v = t.json_payload
if _of_payload == "json_payload" then
n = n + 1; out[n] = "\x12"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 7: jspb_payload
v = t.jspb_payload
if _of_payload == "jspb_payload" then
n = n + 1; out[n] = "\x3a"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 8: text_payload
v = t.text_payload
if _of_payload == "text_payload" then
n = n + 1; out[n] = "\x42"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 3: requested_output_format
v = t.requested_output_format
if v ~= nil then
local nv = v
if type(v) == 'string' then
nv = M.WireFormat[v]
if nv == nil then error("unknown enum value '" .. v .. "' for conformance.WireFormat", 0) end
end
if nv ~= 0 then
n = n + 1; out[n] = "\x18"
n = n + 1; out[n] = wire.encode_int32(nv)
end
end
-- field 4: message_type
v = t.message_type
if v ~= nil and v ~= '' then
n = n + 1; out[n] = "\x22"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 5: test_category
v = t.test_category
if v ~= nil then
local nv = v
if type(v) == 'string' then
nv = M.TestCategory[v]
if nv == nil then error("unknown enum value '" .. v .. "' for conformance.TestCategory", 0) end
end
if nv ~= 0 then
n = n + 1; out[n] = "\x28"
n = n + 1; out[n] = wire.encode_int32(nv)
end
end
-- field 6: jspb_encoding_options
v = t.jspb_encoding_options
if v ~= nil then
n = n + 1; out[n] = "\x32"
n = n + 1; out[n] = wire.encode_len(M.JspbEncodingConfig_encode(v))
end
-- field 9: print_unknown_fields
v = t.print_unknown_fields
if v ~= nil and v ~= false then
n = n + 1; out[n] = "\x48"
n = n + 1; out[n] = wire.encode_bool(v)
end
local _uf = t._unknown_fields
if _uf ~= nil and _uf ~= '' then n = n + 1; out[n] = _uf end
return table.concat(out)
end
function M.ConformanceRequest_decode(buf)
if type(buf) ~= 'string' then
error("expected string for conformance.ConformanceRequest decode, got " .. type(buf), 0)
end
local result = {}
local pos, len = 1, #buf
local _uf
while pos <= len do
local _tag_start = pos
local id, wt
id, wt, pos = wire.decode_tag(buf, pos)
if id == 1 then
local val
val, pos = wire.decode_bytes(buf, pos)
result.protobuf_payload = val
result.json_payload = nil
result.jspb_payload = nil
result.text_payload = nil
elseif id == 2 then
local val
val, pos = wire.decode_string(buf, pos)
result.json_payload = val
result.protobuf_payload = nil
result.jspb_payload = nil
result.text_payload = nil
elseif id == 7 then
local val
val, pos = wire.decode_string(buf, pos)
result.jspb_payload = val
result.protobuf_payload = nil
result.json_payload = nil
result.text_payload = nil
elseif id == 8 then
local val
val, pos = wire.decode_string(buf, pos)
result.text_payload = val
result.protobuf_payload = nil
result.json_payload = nil
result.jspb_payload = nil
elseif id == 3 then
local u
u, pos = wire.decode_varint(buf, pos)
result.requested_output_format = tonumber(u)
elseif id == 4 then
local val
val, pos = wire.decode_string(buf, pos)
result.message_type = val
elseif id == 5 then
local u
u, pos = wire.decode_varint(buf, pos)
result.test_category = tonumber(u)
elseif id == 6 then
local payload
payload, pos = wire.decode_len(buf, pos)
local prev = result.jspb_encoding_options
if prev == nil then
result.jspb_encoding_options = M.JspbEncodingConfig_decode(payload)
else
local new = M.JspbEncodingConfig_decode(payload)
for k, val in pairs(new) do prev[k] = val end
end
elseif id == 9 then
local val
val, pos = wire.decode_bool(buf, pos)
result.print_unknown_fields = val
else
pos = wire.skip_field(buf, pos, wt)
if _uf == nil then _uf = {} end
_uf[#_uf + 1] = buf:sub(_tag_start, pos - 1)
end
end
if _uf ~= nil then result._unknown_fields = table.concat(_uf) end
return result
end
function M.ConformanceRequest_decode_lazy(b) return pb.decode_lazy(M.ConformanceRequest_descriptor, b) end
function M.ConformanceResponse_new(t) return t or {} end
function M.ConformanceResponse_encode(t)
if type(t) ~= 'table' then
error("expected table for conformance.ConformanceResponse, got " .. type(t), 0)
end
local out, n = {}, 0
local v
local _of_result
if t.parse_error ~= nil then _of_result = "parse_error" end
if t.serialize_error ~= nil then _of_result = "serialize_error" end
if t.timeout_error ~= nil then _of_result = "timeout_error" end
if t.runtime_error ~= nil then _of_result = "runtime_error" end
if t.protobuf_payload ~= nil then _of_result = "protobuf_payload" end
if t.json_payload ~= nil then _of_result = "json_payload" end
if t.skipped ~= nil then _of_result = "skipped" end
if t.jspb_payload ~= nil then _of_result = "jspb_payload" end
if t.text_payload ~= nil then _of_result = "text_payload" end
-- field 1: parse_error
v = t.parse_error
if _of_result == "parse_error" then
n = n + 1; out[n] = "\x0a"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 6: serialize_error
v = t.serialize_error
if _of_result == "serialize_error" then
n = n + 1; out[n] = "\x32"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 9: timeout_error
v = t.timeout_error
if _of_result == "timeout_error" then
n = n + 1; out[n] = "\x4a"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 2: runtime_error
v = t.runtime_error
if _of_result == "runtime_error" then
n = n + 1; out[n] = "\x12"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 3: protobuf_payload
v = t.protobuf_payload
if _of_result == "protobuf_payload" then
n = n + 1; out[n] = "\x1a"
n = n + 1; out[n] = wire.encode_bytes(v)
end
-- field 4: json_payload
v = t.json_payload
if _of_result == "json_payload" then
n = n + 1; out[n] = "\x22"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 5: skipped
v = t.skipped
if _of_result == "skipped" then
n = n + 1; out[n] = "\x2a"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 7: jspb_payload
v = t.jspb_payload
if _of_result == "jspb_payload" then
n = n + 1; out[n] = "\x3a"
n = n + 1; out[n] = wire.encode_string(v)
end
-- field 8: text_payload
v = t.text_payload
if _of_result == "text_payload" then
n = n + 1; out[n] = "\x42"
n = n + 1; out[n] = wire.encode_string(v)
end
local _uf = t._unknown_fields
if _uf ~= nil and _uf ~= '' then n = n + 1; out[n] = _uf end
return table.concat(out)
end
function M.ConformanceResponse_decode(buf)
if type(buf) ~= 'string' then
error("expected string for conformance.ConformanceResponse decode, got " .. type(buf), 0)
end
local result = {}
local pos, len = 1, #buf
local _uf
while pos <= len do
local _tag_start = pos
local id, wt
id, wt, pos = wire.decode_tag(buf, pos)
if id == 1 then
local val
val, pos = wire.decode_string(buf, pos)
result.parse_error = val
result.serialize_error = nil
result.timeout_error = nil
result.runtime_error = nil
result.protobuf_payload = nil
result.json_payload = nil
result.skipped = nil
result.jspb_payload = nil
result.text_payload = nil
elseif id == 6 then
local val
val, pos = wire.decode_string(buf, pos)
result.serialize_error = val
result.parse_error = nil
result.timeout_error = nil
result.runtime_error = nil
result.protobuf_payload = nil
result.json_payload = nil
result.skipped = nil
result.jspb_payload = nil
result.text_payload = nil
elseif id == 9 then
local val
val, pos = wire.decode_string(buf, pos)
result.timeout_error = val
result.parse_error = nil
result.serialize_error = nil
result.runtime_error = nil
result.protobuf_payload = nil
result.json_payload = nil
result.skipped = nil
result.jspb_payload = nil
result.text_payload = nil
elseif id == 2 then
local val
val, pos = wire.decode_string(buf, pos)
result.runtime_error = val
result.parse_error = nil
result.serialize_error = nil
result.timeout_error = nil
result.protobuf_payload = nil
result.json_payload = nil
result.skipped = nil
result.jspb_payload = nil
result.text_payload = nil
elseif id == 3 then
local val
val, pos = wire.decode_bytes(buf, pos)
result.protobuf_payload = val
result.parse_error = nil
result.serialize_error = nil
result.timeout_error = nil
result.runtime_error = nil
result.json_payload = nil
result.skipped = nil
result.jspb_payload = nil
result.text_payload = nil
elseif id == 4 then
local val
val, pos = wire.decode_string(buf, pos)
result.json_payload = val
result.parse_error = nil
result.serialize_error = nil
result.timeout_error = nil
result.runtime_error = nil
result.protobuf_payload = nil
result.skipped = nil
result.jspb_payload = nil
result.text_payload = nil
elseif id == 5 then
local val
val, pos = wire.decode_string(buf, pos)
result.skipped = val
result.parse_error = nil
result.serialize_error = nil
result.timeout_error = nil
result.runtime_error = nil
result.protobuf_payload = nil
result.json_payload = nil
result.jspb_payload = nil
result.text_payload = nil
elseif id == 7 then
local val
val, pos = wire.decode_string(buf, pos)
result.jspb_payload = val
result.parse_error = nil
result.serialize_error = nil
result.timeout_error = nil
result.runtime_error = nil
result.protobuf_payload = nil
result.json_payload = nil
result.skipped = nil
result.text_payload = nil
elseif id == 8 then
local val
val, pos = wire.decode_string(buf, pos)
result.text_payload = val
result.parse_error = nil
result.serialize_error = nil
result.timeout_error = nil
result.runtime_error = nil
result.protobuf_payload = nil
result.json_payload = nil
result.skipped = nil
result.jspb_payload = nil
else
pos = wire.skip_field(buf, pos, wt)
if _uf == nil then _uf = {} end
_uf[#_uf + 1] = buf:sub(_tag_start, pos - 1)
end
end
if _uf ~= nil then result._unknown_fields = table.concat(_uf) end
return result
end
function M.ConformanceResponse_decode_lazy(b) return pb.decode_lazy(M.ConformanceResponse_descriptor, b) end
function M.JspbEncodingConfig_new(t) return t or {} end
function M.JspbEncodingConfig_encode(t)
if type(t) ~= 'table' then
error("expected table for conformance.JspbEncodingConfig, got " .. type(t), 0)
end
local out, n = {}, 0
local v
-- field 1: use_jspb_array_any_format
v = t.use_jspb_array_any_format
if v ~= nil and v ~= false then
n = n + 1; out[n] = "\x08"
n = n + 1; out[n] = wire.encode_bool(v)
end
local _uf = t._unknown_fields
if _uf ~= nil and _uf ~= '' then n = n + 1; out[n] = _uf end
return table.concat(out)
end
function M.JspbEncodingConfig_decode(buf)
if type(buf) ~= 'string' then
error("expected string for conformance.JspbEncodingConfig decode, got " .. type(buf), 0)
end
local result = {}
local pos, len = 1, #buf
local _uf
while pos <= len do
local _tag_start = pos
local id, wt
id, wt, pos = wire.decode_tag(buf, pos)
if id == 1 then
local val
val, pos = wire.decode_bool(buf, pos)
result.use_jspb_array_any_format = val
else
pos = wire.skip_field(buf, pos, wt)
if _uf == nil then _uf = {} end
_uf[#_uf + 1] = buf:sub(_tag_start, pos - 1)
end
end
if _uf ~= nil then result._unknown_fields = table.concat(_uf) end
return result
end
function M.JspbEncodingConfig_decode_lazy(b) return pb.decode_lazy(M.JspbEncodingConfig_descriptor, b) end
return M