Răsfoiți Sursa

Reduced JSON complexity in ls_std::Float class

- reduced complexity of JSON serialization in ls_std::Float class by skipping
ls_std::Class serialization part
- adjusted tests
pcmattulat 4 ani în urmă
părinte
comite
7a85f4620a

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

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

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

@@ -29,7 +29,7 @@ namespace {
     ls_std::SerializableJSONFloat serializable {std::make_shared<ls_std::Float>(x)};
     ls_std::String jsonString {serializable.marshal()};
 
-    ASSERT_TRUE(jsonString.contains(R"({"class":"Float","value":3.14159)"));
+    ASSERT_TRUE(jsonString.contains(R"({"value":3.14159)"));
   }
 
   TEST_F(SerializableJSONFloatTest, unmarshal)
@@ -38,7 +38,7 @@ namespace {
     ASSERT_FLOAT_EQ(14.2234f, *x);
 
     ls_std::SerializableJSONFloat serializable {x};
-    serializable.unmarshal(R"({"class":"Float","value":3.14159})");
+    serializable.unmarshal(R"({"value":3.14159})");
 
     ASSERT_FLOAT_EQ(3.14159f, *x);
   }