blob: 2ac7adc6f6df0d60c117229c93cb4979da311273 [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
Jake Farrell5d02b802014-01-07 21:42:01 -050020#define _USE_MATH_DEFINES
David Reissdb0ea152008-02-18 01:49:37 +000021#include <cmath>
Konrad Grochowskia84e1392015-10-16 11:22:10 +020022#include <iomanip>
23#include <sstream>
Roger Meier49ff8b12012-04-13 09:12:31 +000024#include <thrift/transport/TBufferTransports.h>
25#include <thrift/protocol/TJSONProtocol.h>
James E. King, IIIe1832c32017-02-10 13:03:10 -050026#include <boost/scoped_ptr.hpp>
David Reissdb0ea152008-02-18 01:49:37 +000027#include "gen-cpp/DebugProtoTest_types.h"
28
Claudius Heine5ef662b2015-06-24 10:03:50 +020029#define BOOST_TEST_MODULE JSONProtoTest
30#include <boost/test/unit_test.hpp>
David Reissdb0ea152008-02-18 01:49:37 +000031
Claudius Heine5ef662b2015-06-24 10:03:50 +020032using namespace thrift::test::debug;
33using apache::thrift::transport::TMemoryBuffer;
34using apache::thrift::protocol::TJSONProtocol;
David Reissdb0ea152008-02-18 01:49:37 +000035
James E. King, IIIe1832c32017-02-10 13:03:10 -050036static boost::scoped_ptr<OneOfEach> ooe;
David Reissdb0ea152008-02-18 01:49:37 +000037
Claudius Heine5ef662b2015-06-24 10:03:50 +020038void testCaseSetup_1() {
39 ooe.reset(new OneOfEach);
40 ooe->im_true = true;
41 ooe->im_false = false;
42 ooe->a_bite = 0x7f;
43 ooe->integer16 = 27000;
44 ooe->integer32 = 1 << 24;
45 ooe->integer64 = (uint64_t)6000 * 1000 * 1000;
46 ooe->double_precision = M_PI;
47 ooe->some_characters = "JSON THIS! \"\1";
48 ooe->zomg_unicode = "\xd7\n\a\t";
49 ooe->base64 = "\1\2\3\255";
50}
David Reissdb0ea152008-02-18 01:49:37 +000051
Claudius Heine5ef662b2015-06-24 10:03:50 +020052BOOST_AUTO_TEST_CASE(test_json_proto_1) {
53 testCaseSetup_1();
David Reissdb0ea152008-02-18 01:49:37 +000054
Claudius Heine5ef662b2015-06-24 10:03:50 +020055 const std::string expected_result(
56 "{\"1\":{\"tf\":1},\"2\":{\"tf\":0},\"3\":{\"i8\":127},\"4\":{\"i16\":27000},"
57 "\"5\":{\"i32\":16777216},\"6\":{\"i64\":6000000000},\"7\":{\"dbl\":3.1415926"
Wang Yaofu0433d172016-02-15 10:43:09 +080058 "535897931},\"8\":{\"str\":\"JSON THIS! \\\"\\u0001\"},\"9\":{\"str\":\"\xd7\\"
Claudius Heine5ef662b2015-06-24 10:03:50 +020059 "n\\u0007\\t\"},\"10\":{\"tf\":0},\"11\":{\"str\":\"AQIDrQ\"},\"12\":{\"lst\""
60 ":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16\",3,1,2,3]},\"14\":{\"lst\":[\"i64"
61 "\",3,1,2,3]}}");
62
63 const std::string result(apache::thrift::ThriftJSONString(*ooe));
64
65 BOOST_CHECK_MESSAGE(!expected_result.compare(result),
66 "Expected:\n" << expected_result << "\nGotten:\n" << result);
67}
68
James E. King, IIIe1832c32017-02-10 13:03:10 -050069static boost::scoped_ptr<Nesting> n;
Claudius Heine5ef662b2015-06-24 10:03:50 +020070
71void testCaseSetup_2() {
72 testCaseSetup_1();
73
74 n.reset(new Nesting);
75 n->my_ooe = *ooe;
76 n->my_ooe.integer16 = 16;
77 n->my_ooe.integer32 = 32;
78 n->my_ooe.integer64 = 64;
79 n->my_ooe.double_precision = (std::sqrt(5.0) + 1) / 2;
80 n->my_ooe.some_characters = ":R (me going \"rrrr\")";
81 n->my_ooe.zomg_unicode = "\xd3\x80\xe2\x85\xae\xce\x9d\x20\xd0\x9d\xce"
82 "\xbf\xe2\x85\xbf\xd0\xbe\xc9\xa1\xd0\xb3\xd0"
83 "\xb0\xcf\x81\xe2\x84\x8e\x20\xce\x91\x74\x74"
84 "\xce\xb1\xe2\x85\xbd\xce\xba\xc7\x83\xe2\x80"
85 "\xbc";
86 n->my_bonk.type = 31337;
87 n->my_bonk.message = "I am a bonk... xor!";
88}
89
90BOOST_AUTO_TEST_CASE(test_json_proto_2) {
91 testCaseSetup_2();
92
93 const std::string expected_result(
94 "{\"1\":{\"rec\":{\"1\":{\"i32\":31337},\"2\":{\"str\":\"I am a bonk... xor"
95 "!\"}}},\"2\":{\"rec\":{\"1\":{\"tf\":1},\"2\":{\"tf\":0},\"3\":{\"i8\":127"
96 "},\"4\":{\"i16\":16},\"5\":{\"i32\":32},\"6\":{\"i64\":64},\"7\":{\"dbl\":"
Wang Yaofu0433d172016-02-15 10:43:09 +080097 "1.6180339887498949},\"8\":{\"str\":\":R (me going \\\"rrrr\\\")\"},\"9\":{"
Claudius Heine5ef662b2015-06-24 10:03:50 +020098 "\"str\":\"ӀⅮΝ Нοⅿоɡгаρℎ Αttαⅽκǃ‼\"},\"10\":{\"tf\":0},\"11\":{\"str\":\""
99 "AQIDrQ\"},\"12\":{\"lst\":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16\",3,1,2"
100 ",3]},\"14\":{\"lst\":[\"i64\",3,1,2,3]}}}}"
101 );
102
103 const std::string result(apache::thrift::ThriftJSONString(*n));
104
105 BOOST_CHECK_MESSAGE(!expected_result.compare(result),
106 "Expected:\n" << expected_result << "\nGotten:\n" << result);
107}
108
James E. King, IIIe1832c32017-02-10 13:03:10 -0500109static boost::scoped_ptr<HolyMoley> hm;
Claudius Heine5ef662b2015-06-24 10:03:50 +0200110
111void testCaseSetup_3() {
112 testCaseSetup_2();
113
114 hm.reset(new HolyMoley);
115
116 hm->big.push_back(*ooe);
117 hm->big.push_back(n->my_ooe);
118 hm->big[0].a_bite = 0x22;
119 hm->big[1].a_bite = 0x33;
David Reissdb0ea152008-02-18 01:49:37 +0000120
121 std::vector<std::string> stage1;
122 stage1.push_back("and a one");
123 stage1.push_back("and a two");
Claudius Heine5ef662b2015-06-24 10:03:50 +0200124 hm->contain.insert(stage1);
David Reissdb0ea152008-02-18 01:49:37 +0000125 stage1.clear();
126 stage1.push_back("then a one, two");
127 stage1.push_back("three!");
128 stage1.push_back("FOUR!!");
Claudius Heine5ef662b2015-06-24 10:03:50 +0200129 hm->contain.insert(stage1);
David Reissdb0ea152008-02-18 01:49:37 +0000130 stage1.clear();
Claudius Heine5ef662b2015-06-24 10:03:50 +0200131 hm->contain.insert(stage1);
David Reissdb0ea152008-02-18 01:49:37 +0000132
133 std::vector<Bonk> stage2;
Claudius Heine5ef662b2015-06-24 10:03:50 +0200134 hm->bonks["nothing"] = stage2;
Konrad Grochowski16a23a62014-11-13 15:33:38 +0100135 stage2.resize(stage2.size() + 1);
David Reissdb0ea152008-02-18 01:49:37 +0000136 stage2.back().type = 1;
137 stage2.back().message = "Wait.";
Konrad Grochowski16a23a62014-11-13 15:33:38 +0100138 stage2.resize(stage2.size() + 1);
David Reissdb0ea152008-02-18 01:49:37 +0000139 stage2.back().type = 2;
140 stage2.back().message = "What?";
Claudius Heine5ef662b2015-06-24 10:03:50 +0200141 hm->bonks["something"] = stage2;
David Reissdb0ea152008-02-18 01:49:37 +0000142 stage2.clear();
Konrad Grochowski16a23a62014-11-13 15:33:38 +0100143 stage2.resize(stage2.size() + 1);
David Reissdb0ea152008-02-18 01:49:37 +0000144 stage2.back().type = 3;
145 stage2.back().message = "quoth";
Konrad Grochowski16a23a62014-11-13 15:33:38 +0100146 stage2.resize(stage2.size() + 1);
David Reissdb0ea152008-02-18 01:49:37 +0000147 stage2.back().type = 4;
148 stage2.back().message = "the raven";
Konrad Grochowski16a23a62014-11-13 15:33:38 +0100149 stage2.resize(stage2.size() + 1);
David Reissdb0ea152008-02-18 01:49:37 +0000150 stage2.back().type = 5;
151 stage2.back().message = "nevermore";
Claudius Heine5ef662b2015-06-24 10:03:50 +0200152 hm->bonks["poe"] = stage2;
153}
David Reissdb0ea152008-02-18 01:49:37 +0000154
Claudius Heine5ef662b2015-06-24 10:03:50 +0200155BOOST_AUTO_TEST_CASE(test_json_proto_3) {
156 testCaseSetup_3();
157
158 const std::string expected_result(
159 "{\"1\":{\"lst\":[\"rec\",2,{\"1\":{\"tf\":1},\"2\":{\"tf\":0},\"3\":{\"i8\":"
160 "34},\"4\":{\"i16\":27000},\"5\":{\"i32\":16777216},\"6\":{\"i64\":6000000000"
Wang Yaofu0433d172016-02-15 10:43:09 +0800161 "},\"7\":{\"dbl\":3.1415926535897931},\"8\":{\"str\":\"JSON THIS! \\\"\\u0001"
Claudius Heine5ef662b2015-06-24 10:03:50 +0200162 "\"},\"9\":{\"str\":\"\xd7\\n\\u0007\\t\"},\"10\":{\"tf\":0},\"11\":{\"str\":"
163 "\"AQIDrQ\"},\"12\":{\"lst\":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16\",3,1,2"
164 ",3]},\"14\":{\"lst\":[\"i64\",3,1,2,3]}},{\"1\":{\"tf\":1},\"2\":{\"tf\":0},"
165 "\"3\":{\"i8\":51},\"4\":{\"i16\":16},\"5\":{\"i32\":32},\"6\":{\"i64\":64},"
Wang Yaofu0433d172016-02-15 10:43:09 +0800166 "\"7\":{\"dbl\":1.6180339887498949},\"8\":{\"str\":\":R (me going \\\"rrrr\\\""
Claudius Heine5ef662b2015-06-24 10:03:50 +0200167 ")\"},\"9\":{\"str\":\"ӀⅮΝ Нοⅿоɡгаρℎ Αttαⅽκǃ‼\"},\"10\":{\"tf\":0},\"11\":{"
168 "\"str\":\"AQIDrQ\"},\"12\":{\"lst\":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16"
169 "\",3,1,2,3]},\"14\":{\"lst\":[\"i64\",3,1,2,3]}}]},\"2\":{\"set\":[\"lst\",3"
170 ",[\"str\",0],[\"str\",2,\"and a one\",\"and a two\"],[\"str\",3,\"then a one"
171 ", two\",\"three!\",\"FOUR!!\"]]},\"3\":{\"map\":[\"str\",\"lst\",3,{\"nothin"
172 "g\":[\"rec\",0],\"poe\":[\"rec\",3,{\"1\":{\"i32\":3},\"2\":{\"str\":\"quoth"
173 "\"}},{\"1\":{\"i32\":4},\"2\":{\"str\":\"the raven\"}},{\"1\":{\"i32\":5},\""
174 "2\":{\"str\":\"nevermore\"}}],\"something\":[\"rec\",2,{\"1\":{\"i32\":1},\""
175 "2\":{\"str\":\"Wait.\"}},{\"1\":{\"i32\":2},\"2\":{\"str\":\"What?\"}}]}]}}"
176 );
177
178 const std::string result(apache::thrift::ThriftJSONString(*hm));
179
180 BOOST_CHECK_MESSAGE(!expected_result.compare(result),
181 "Expected:\n" << expected_result << "\nGotten:\n" << result);
182}
183
184BOOST_AUTO_TEST_CASE(test_json_proto_4) {
185 testCaseSetup_1();
David Reissdb0ea152008-02-18 01:49:37 +0000186
187 boost::shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer());
188 boost::shared_ptr<TJSONProtocol> proto(new TJSONProtocol(buffer));
189
Claudius Heine5ef662b2015-06-24 10:03:50 +0200190 ooe->write(proto.get());
David Reissdb0ea152008-02-18 01:49:37 +0000191 OneOfEach ooe2;
192 ooe2.read(proto.get());
193
Claudius Heine5ef662b2015-06-24 10:03:50 +0200194 BOOST_CHECK(*ooe == ooe2);
195}
David Reissdb0ea152008-02-18 01:49:37 +0000196
Claudius Heine5ef662b2015-06-24 10:03:50 +0200197BOOST_AUTO_TEST_CASE(test_json_proto_5) {
198 testCaseSetup_3();
David Reissdb0ea152008-02-18 01:49:37 +0000199
Claudius Heine5ef662b2015-06-24 10:03:50 +0200200 boost::shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer());
201 boost::shared_ptr<TJSONProtocol> proto(new TJSONProtocol(buffer));
202
203 hm->write(proto.get());
David Reissdb0ea152008-02-18 01:49:37 +0000204 HolyMoley hm2;
205 hm2.read(proto.get());
206
Claudius Heine5ef662b2015-06-24 10:03:50 +0200207 BOOST_CHECK(*hm == hm2);
David Reissdb0ea152008-02-18 01:49:37 +0000208
Christian Lavoiecbf87cb2010-11-28 14:34:26 +0000209 hm2.big[0].a_bite = 0x00;
David Reiss4a8f46c2008-03-07 20:12:07 +0000210
Claudius Heine5ef662b2015-06-24 10:03:50 +0200211 BOOST_CHECK(*hm != hm2);
212}
David Reiss4a8f46c2008-03-07 20:12:07 +0000213
Claudius Heine5ef662b2015-06-24 10:03:50 +0200214BOOST_AUTO_TEST_CASE(test_json_proto_6) {
David Reissdb0ea152008-02-18 01:49:37 +0000215 Doubles dub;
Konrad Grochowski16a23a62014-11-13 15:33:38 +0100216 dub.nan = HUGE_VAL / HUGE_VAL;
David Reissdb0ea152008-02-18 01:49:37 +0000217 dub.inf = HUGE_VAL;
218 dub.neginf = -HUGE_VAL;
Konrad Grochowski16a23a62014-11-13 15:33:38 +0100219 dub.repeating = 10.0 / 3.0;
David Reissdb0ea152008-02-18 01:49:37 +0000220 dub.big = 1E+305;
Roger Meier22888ce2014-02-09 11:31:02 +0100221 dub.tiny = 1E-305;
David Reissdb0ea152008-02-18 01:49:37 +0000222 dub.zero = 0.0;
223 dub.negzero = -0.0;
David Reissdb0ea152008-02-18 01:49:37 +0000224
Claudius Heine5ef662b2015-06-24 10:03:50 +0200225 const std::string expected_result(
226 "{\"1\":{\"dbl\":\"NaN\"},\"2\":{\"dbl\":\"Infinity\"},\"3\":{\"dbl\":\"-Infi"
Wang Yaofu0433d172016-02-15 10:43:09 +0800227 "nity\"},\"4\":{\"dbl\":3.3333333333333335},\"5\":{\"dbl\":9.9999999999999994e+"
Claudius Heine5ef662b2015-06-24 10:03:50 +0200228 "304},\"6\":{\"dbl\":1e-305},\"7\":{\"dbl\":0},\"8\":{\"dbl\":-0}}"
229 );
230
231 const std::string result(apache::thrift::ThriftJSONString(dub));
232
233 BOOST_CHECK_MESSAGE(!expected_result.compare(result),
234 "Expected:\n" << expected_result << "\nGotten:\n" << result);
235}
236
237BOOST_AUTO_TEST_CASE(test_json_proto_7) {
238 boost::shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer());
239 boost::shared_ptr<TJSONProtocol> proto(new TJSONProtocol(buffer));
David Reiss4a8f46c2008-03-07 20:12:07 +0000240
241 Base64 base;
242 base.a = 123;
243 base.b1 = "1";
244 base.b2 = "12";
245 base.b3 = "123";
246 base.b4 = "1234";
247 base.b5 = "12345";
248 base.b6 = "123456";
249
250 base.write(proto.get());
251 Base64 base2;
252 base2.read(proto.get());
253
Claudius Heine5ef662b2015-06-24 10:03:50 +0200254 BOOST_CHECK(base == base2);
David Reissdb0ea152008-02-18 01:49:37 +0000255}
Claudius Heine8f11f522015-07-01 10:35:38 +0200256
257BOOST_AUTO_TEST_CASE(test_json_proto_8) {
258 const char* json_string =
259 "{\"1\":{\"tf\":1},\"2\":{\"tf\":0},\"3\":{\"i8\":127},\"4\":{\"i16\":27000},"
260 "\"5\":{\"i32\":16.77216},\"6\":{\"i64\":6000000000},\"7\":{\"dbl\":3.1415926"
Wang Yaofu0433d172016-02-15 10:43:09 +0800261 "535897931},\"8\":{\"str\":\"JSON THIS! \\\"\\u0001\"},\"9\":{\"str\":\"\xd7\\"
Claudius Heine8f11f522015-07-01 10:35:38 +0200262 "n\\u0007\\t\"},\"10\":{\"tf\":0},\"11\":{\"str\":\"AQIDrQ\"},\"12\":{\"lst\""
263 ":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16\",3,1,2,3]},\"14\":{\"lst\":[\"i64"
264 "\",3,1,2,3]}}";
265
James E. King, III7edc8fa2017-01-20 10:11:41 -0500266 const std::size_t bufSiz = strlen(json_string) * sizeof(char);
Claudius Heine8f11f522015-07-01 10:35:38 +0200267 boost::shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(
James E. King, III7edc8fa2017-01-20 10:11:41 -0500268 (uint8_t*)(json_string), static_cast<uint32_t>(bufSiz)));
Claudius Heine8f11f522015-07-01 10:35:38 +0200269 boost::shared_ptr<TJSONProtocol> proto(new TJSONProtocol(buffer));
270
271 OneOfEach ooe2;
272
273 BOOST_CHECK_THROW(ooe2.read(proto.get()),
274 apache::thrift::protocol::TProtocolException);
275}
Konrad Grochowskia84e1392015-10-16 11:22:10 +0200276
277static std::string toHexSequence(const std::string& str) {
278 std::stringstream ss;
279 ss << std::hex << std::setfill('0');
280 for (std::size_t i = 0; i < str.size(); i++) {
281 ss << "\\x" << int(uint8_t(str[i]));
282 }
283 return ss.str();
284}
285
286BOOST_AUTO_TEST_CASE(test_json_unicode_escaped) {
287 const char json_string[] =
288 "{\"1\":{\"tf\":1},\"2\":{\"tf\":0},\"3\":{\"i8\":127},\"4\":{\"i16\":27000},"
289 "\"5\":{\"i32\":16},\"6\":{\"i64\":6000000000},\"7\":{\"dbl\":3.1415926"
Wang Yaofu0433d172016-02-15 10:43:09 +0800290 "535897931},\"8\":{\"str\":\"JSON THIS!\"},\"9\":{\"str\":\"\\u0e01 \\ud835\\udd3e\"},"
Konrad Grochowskia84e1392015-10-16 11:22:10 +0200291 "\"10\":{\"tf\":0},\"11\":{\"str\":\"000000\"},\"12\":{\"lst\""
292 ":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16\",3,1,2,3]},\"14\":{\"lst\":[\"i64"
293 "\",3,1,2,3]}}";
294 const char* expected_zomg_unicode = "\xe0\xb8\x81 \xf0\x9d\x94\xbe";
295
296 boost::shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(
297 (uint8_t*)(json_string), sizeof(json_string)));
298 boost::shared_ptr<TJSONProtocol> proto(new TJSONProtocol(buffer));
299
300 OneOfEach ooe2;
301 ooe2.read(proto.get());
302 BOOST_CHECK_MESSAGE(!ooe2.zomg_unicode.compare(expected_zomg_unicode),
303 "Expected:\n" << toHexSequence(expected_zomg_unicode) << "\nGotten:\n"
304 << toHexSequence(ooe2.zomg_unicode));
305
306}
307
308BOOST_AUTO_TEST_CASE(test_json_unicode_escaped_missing_low_surrogate) {
309 const char json_string[] =
310 "{\"1\":{\"tf\":1},\"2\":{\"tf\":0},\"3\":{\"i8\":127},\"4\":{\"i16\":27000},"
311 "\"5\":{\"i32\":16},\"6\":{\"i64\":6000000000},\"7\":{\"dbl\":3.1415926"
Wang Yaofu0433d172016-02-15 10:43:09 +0800312 "535897931},\"8\":{\"str\":\"JSON THIS!\"},\"9\":{\"str\":\"\\ud835\"},"
Konrad Grochowskia84e1392015-10-16 11:22:10 +0200313 "\"10\":{\"tf\":0},\"11\":{\"str\":\"000000\"},\"12\":{\"lst\""
314 ":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16\",3,1,2,3]},\"14\":{\"lst\":[\"i64"
315 "\",3,1,2,3]}}";
316
317 boost::shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(
318 (uint8_t*)(json_string), sizeof(json_string)));
319 boost::shared_ptr<TJSONProtocol> proto(new TJSONProtocol(buffer));
320
321 OneOfEach ooe2;
322 BOOST_CHECK_THROW(ooe2.read(proto.get()),
323 apache::thrift::protocol::TProtocolException);
324}
325
326BOOST_AUTO_TEST_CASE(test_json_unicode_escaped_missing_hi_surrogate) {
327 const char json_string[] =
328 "{\"1\":{\"tf\":1},\"2\":{\"tf\":0},\"3\":{\"i8\":127},\"4\":{\"i16\":27000},"
329 "\"5\":{\"i32\":16},\"6\":{\"i64\":6000000000},\"7\":{\"dbl\":3.1415926"
Wang Yaofu0433d172016-02-15 10:43:09 +0800330 "535897931},\"8\":{\"str\":\"JSON THIS!\"},\"9\":{\"str\":\"\\udd3e\"},"
Konrad Grochowskia84e1392015-10-16 11:22:10 +0200331 "\"10\":{\"tf\":0},\"11\":{\"str\":\"000000\"},\"12\":{\"lst\""
332 ":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16\",3,1,2,3]},\"14\":{\"lst\":[\"i64"
333 "\",3,1,2,3]}}";
334
335 boost::shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(
336 (uint8_t*)(json_string), sizeof(json_string)));
337 boost::shared_ptr<TJSONProtocol> proto(new TJSONProtocol(buffer));
338
339 OneOfEach ooe2;
340 BOOST_CHECK_THROW(ooe2.read(proto.get()),
341 apache::thrift::protocol::TProtocolException);
342}