You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2020/03/31 21:07:02 UTC

[thrift] branch master updated: Add testcase for other condition judgment in the readJSONDouble function Client: cpp Patch: zeshuai007 <51382517@qq.com>

This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 86396c6  Add testcase for other condition judgment in the readJSONDouble function Client: cpp Patch: zeshuai007 <51...@qq.com>
86396c6 is described below

commit 86396c688068c428d997ad3209823ab5a2e3dcae
Author: zeshuai007 <51...@qq.com>
AuthorDate: Tue Mar 31 14:38:20 2020 +0800

    Add testcase for other condition judgment in the readJSONDouble function
    Client: cpp
    Patch: zeshuai007 <51...@qq.com>
    
    This closes #2080
---
 lib/cpp/test/JSONProtoTest.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/cpp/test/JSONProtoTest.cpp b/lib/cpp/test/JSONProtoTest.cpp
index c2ad73e..082c8a2 100644
--- a/lib/cpp/test/JSONProtoTest.cpp
+++ b/lib/cpp/test/JSONProtoTest.cpp
@@ -229,10 +229,19 @@ BOOST_AUTO_TEST_CASE(test_json_proto_6) {
   "304},\"6\":{\"dbl\":1e-305},\"7\":{\"dbl\":0},\"8\":{\"dbl\":-0}}"
   );
 
-  const std::string result(apache::thrift::ThriftJSONString(dub));
+  std::shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer());
+  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),
+    "Expected:\n" << expected_result << "\nGotten:\n" << result_1);
 }
 
 BOOST_AUTO_TEST_CASE(test_json_proto_7) {