Add more complete base64 testing for C++ JSON protocol.
authorDavid Reiss <dreiss@apache.org>
Fri, 7 Mar 2008 20:12:07 +0000 (20:12 +0000)
committerDavid Reiss <dreiss@apache.org>
Fri, 7 Mar 2008 20:12:07 +0000 (20:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665559 13f79535-47bb-0310-9956-ffa450edef68

test/DebugProtoTest.thrift
test/JSONProtoTest.cpp

index 7f031c6..fb86bf4 100644 (file)
@@ -65,6 +65,16 @@ struct RandomStuff {
   8: double triple,
 }
 
+struct Base64 {
+  1: i32 a,
+  2: binary b1,
+  3: binary b2,
+  4: binary b3,
+  5: binary b4,
+  6: binary b5,
+  7: binary b6,
+}
+
 service Srv {
   i32 Janky(i32 arg)
 }
index 077d2c4..30d712f 100644 (file)
@@ -104,6 +104,10 @@ int main() {
 
   assert(hm == hm2);
 
+  hm2.big[0].a_bite = 0xFF;
+
+  assert(hm != hm2);
+
   Doubles dub;
   dub.nan = HUGE_VAL/HUGE_VAL;
   dub.inf = HUGE_VAL;
@@ -115,5 +119,22 @@ int main() {
   dub.negzero = -0.0;
   cout << facebook::thrift::ThriftJSONString(dub) << endl << endl;
 
+  cout << "Testing base" << endl;
+
+  Base64 base;
+  base.a = 123;
+  base.b1 = "1";
+  base.b2 = "12";
+  base.b3 = "123";
+  base.b4 = "1234";
+  base.b5 = "12345";
+  base.b6 = "123456";
+
+  base.write(proto.get());
+  Base64 base2;
+  base2.read(proto.get());
+
+  assert(base == base2);
+
   return 0;
 }