THRIFT-5772: UUID support for c++ #2952
Client: cpp
Patch: CJCombrink

This closes #2952
diff --git a/lib/cpp/test/JSONProtoTest.cpp b/lib/cpp/test/JSONProtoTest.cpp
index 082c8a2..fedf99e 100644
--- a/lib/cpp/test/JSONProtoTest.cpp
+++ b/lib/cpp/test/JSONProtoTest.cpp
@@ -48,6 +48,7 @@
   ooe->some_characters = "JSON THIS! \"\1";
   ooe->zomg_unicode = "\xd7\n\a\t";
   ooe->base64 = "\1\2\3\255";
+  ooe->rfc4122_uuid = "00000000-0000-0000-0000-000000000000";
 }
 
 BOOST_AUTO_TEST_CASE(test_json_proto_1) {
@@ -59,7 +60,7 @@
   "535897931},\"8\":{\"str\":\"JSON THIS! \\\"\\u0001\"},\"9\":{\"str\":\"\xd7\\"
   "n\\u0007\\t\"},\"10\":{\"tf\":0},\"11\":{\"str\":\"AQIDrQ\"},\"12\":{\"lst\""
   ":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16\",3,1,2,3]},\"14\":{\"lst\":[\"i64"
-  "\",3,1,2,3]}}");
+  "\",3,1,2,3]},\"15\":{\"uid\":\"00000000-0000-0000-0000-000000000000\"}}");
 
   const std::string result(apache::thrift::ThriftJSONString(*ooe));
 
@@ -84,6 +85,7 @@
                                "\xb0\xcf\x81\xe2\x84\x8e\x20\xce\x91\x74\x74"
                                "\xce\xb1\xe2\x85\xbd\xce\xba\xc7\x83\xe2\x80"
                                "\xbc";
+  n->my_ooe.rfc4122_uuid = "5e2ab188-1726-4e75-a04f-1ed9a6a89c4c";
   n->my_bonk.type = 31337;
   n->my_bonk.message = "I am a bonk... xor!";
 }
@@ -98,7 +100,8 @@
     "1.6180339887498949},\"8\":{\"str\":\":R (me going \\\"rrrr\\\")\"},\"9\":{"
     "\"str\":\"ӀⅮΝ Нοⅿоɡгаρℎ Αttαⅽκǃ‼\"},\"10\":{\"tf\":0},\"11\":{\"str\":\""
     "AQIDrQ\"},\"12\":{\"lst\":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16\",3,1,2"
-    ",3]},\"14\":{\"lst\":[\"i64\",3,1,2,3]}}}}"
+    ",3]},\"14\":{\"lst\":[\"i64\",3,1,2,3]},\"15\":{\"uid\":\"5e2ab188-1726-"
+    "4e75-a04f-1ed9a6a89c4c\"}}}}"
   );
 
   const std::string result(apache::thrift::ThriftJSONString(*n));
@@ -162,12 +165,14 @@
   "},\"7\":{\"dbl\":3.1415926535897931},\"8\":{\"str\":\"JSON THIS! \\\"\\u0001"
   "\"},\"9\":{\"str\":\"\xd7\\n\\u0007\\t\"},\"10\":{\"tf\":0},\"11\":{\"str\":"
   "\"AQIDrQ\"},\"12\":{\"lst\":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16\",3,1,2"
-  ",3]},\"14\":{\"lst\":[\"i64\",3,1,2,3]}},{\"1\":{\"tf\":1},\"2\":{\"tf\":0},"
+  ",3]},\"14\":{\"lst\":[\"i64\",3,1,2,3]},\"15\":{\"uid\":\"00000000-0000-0000"
+  "-0000-000000000000\"}},{\"1\":{\"tf\":1},\"2\":{\"tf\":0},"
   "\"3\":{\"i8\":51},\"4\":{\"i16\":16},\"5\":{\"i32\":32},\"6\":{\"i64\":64},"
   "\"7\":{\"dbl\":1.6180339887498949},\"8\":{\"str\":\":R (me going \\\"rrrr\\\""
   ")\"},\"9\":{\"str\":\"ӀⅮΝ Нοⅿоɡгаρℎ Αttαⅽκǃ‼\"},\"10\":{\"tf\":0},\"11\":{"
   "\"str\":\"AQIDrQ\"},\"12\":{\"lst\":[\"i8\",3,1,2,3]},\"13\":{\"lst\":[\"i16"
-  "\",3,1,2,3]},\"14\":{\"lst\":[\"i64\",3,1,2,3]}}]},\"2\":{\"set\":[\"lst\",3"
+  "\",3,1,2,3]},\"14\":{\"lst\":[\"i64\",3,1,2,3]},\"15\":{\"uid\":\"5e2ab188-"
+  "1726-4e75-a04f-1ed9a6a89c4c\"}}]},\"2\":{\"set\":[\"lst\",3"
   ",[\"str\",0],[\"str\",2,\"and a one\",\"and a two\"],[\"str\",3,\"then a one"
   ", two\",\"three!\",\"FOUR!!\"]]},\"3\":{\"map\":[\"str\",\"lst\",3,{\"nothin"
   "g\":[\"rec\",0],\"poe\":[\"rec\",3,{\"1\":{\"i32\":3},\"2\":{\"str\":\"quoth"
@@ -192,6 +197,8 @@
   OneOfEach ooe2;
   ooe2.read(proto.get());
 
+  BOOST_TEST_INFO("written: " << *ooe);
+  BOOST_TEST_INFO("read   : " << ooe2);
   BOOST_CHECK(*ooe == ooe2);
 }
 
@@ -205,6 +212,8 @@
   HolyMoley hm2;
   hm2.read(proto.get());
 
+  BOOST_TEST_INFO("written: " << *hm);
+  BOOST_TEST_INFO("read   : " << hm2);
   BOOST_CHECK(*hm == hm2);
 
   hm2.big[0].a_bite = 0x00;
@@ -230,14 +239,14 @@
   );
 
   std::shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer());
-  std::shared_ptr<TJSONProtocol> proto(new TJSONProtocol(buffer)); 
+  std::shared_ptr<TJSONProtocol> proto(new TJSONProtocol(buffer));
   dub.write(proto.get());
   Doubles dub_1;
   dub_1.read(proto.get());
 
   const std::string result(apache::thrift::ThriftJSONString(dub));
   const std::string result_1(apache::thrift::ThriftJSONString(dub_1));
-  
+
   BOOST_CHECK_MESSAGE(!expected_result.compare(result),
     "Expected:\n" << expected_result << "\nGotten:\n" << result);
   BOOST_CHECK_MESSAGE(!expected_result.compare(result_1),