Ver código fonte

Reduced JSON complexity in ls_std::Double class

- reduced complexity of JSON serialization in ls_std::Double class by skipping
ls_std::Class serialization part
- adjusted tests
pcmattulat 4 anos atrás
pai
commit
0489ad5fef

+ 0 - 1
source/serialization/boxing/SerializableJSONDouble.cpp

@@ -33,7 +33,6 @@ void ls_std::SerializableJSONDouble::unmarshal(const ls_std::byte_field& _data)
 void ls_std::SerializableJSONDouble::_update()
 {
   this->jsonObject = {
-      {"class", this->value->getClassName()},
       {"value", this->value->getValue()}
   };
 }

+ 2 - 2
test/cases/serialization/boxing/SerializableJSONDoubleTest.cpp

@@ -29,7 +29,7 @@ namespace {
     ls_std::SerializableJSONDouble serializable {std::make_shared<ls_std::Double>(x)};
     ls_std::String jsonString {serializable.marshal()};
 
-    ASSERT_TRUE(jsonString.contains(R"({"class":"Double","value":3.14159)"));
+    ASSERT_TRUE(jsonString.contains(R"({"value":3.14159)"));
   }
 
   TEST_F(SerializableJSONDoubleTest, unmarshal)
@@ -39,7 +39,7 @@ namespace {
     ASSERT_DOUBLE_EQ(14.2234, *x);
 
     ls_std::SerializableJSONDouble serializable {x};
-    serializable.unmarshal(R"({"class":"Double","value":3.14159})");
+    serializable.unmarshal(R"({"value":3.14159})");
 
     ASSERT_DOUBLE_EQ(3.14159, *x);
   }