|
@@ -3,12 +3,13 @@
|
|
* Company: Lynar Studios
|
|
* Company: Lynar Studios
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
* Created: 2020-08-17
|
|
* Created: 2020-08-17
|
|
- * Changed: 2020-08-26
|
|
|
|
|
|
+ * Changed: 2020-08-27
|
|
*
|
|
*
|
|
* */
|
|
* */
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <gtest/gtest.h>
|
|
#include "../../../source/boxing/Long.hpp"
|
|
#include "../../../source/boxing/Long.hpp"
|
|
|
|
+#include "../../../source/serialization/boxing/SerializableJSONLong.hpp"
|
|
|
|
|
|
namespace {
|
|
namespace {
|
|
class LongTest : public ::testing::Test {
|
|
class LongTest : public ::testing::Test {
|
|
@@ -337,6 +338,19 @@ namespace {
|
|
|
|
|
|
// implementation
|
|
// implementation
|
|
|
|
|
|
|
|
+ TEST_F(LongTest, marshal)
|
|
|
|
+ {
|
|
|
|
+ std::shared_ptr<ls_std::Long> x = std::make_shared<ls_std::Long>(3);
|
|
|
|
+
|
|
|
|
+ auto serializable = std::make_shared<ls_std::SerializableJSONLong>(x);
|
|
|
|
+ x->setSerializable(std::dynamic_pointer_cast<ls_std::ISerializable>(serializable));
|
|
|
|
+
|
|
|
|
+ ASSERT_STREQ(R"({"class":"Long","value":3})", x->marshal().c_str());
|
|
|
|
+
|
|
|
|
+ *x = 17;
|
|
|
|
+ ASSERT_STREQ(R"({"class":"Long","value":17})", x->marshal().c_str());
|
|
|
|
+ }
|
|
|
|
+
|
|
TEST_F(LongTest, parse)
|
|
TEST_F(LongTest, parse)
|
|
{
|
|
{
|
|
ls_std::Long x {};
|
|
ls_std::Long x {};
|
|
@@ -354,6 +368,19 @@ namespace {
|
|
ASSERT_STREQ("112", x.toString().c_str());
|
|
ASSERT_STREQ("112", x.toString().c_str());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ TEST_F(LongTest, unmarshal)
|
|
|
|
+ {
|
|
|
|
+ std::shared_ptr<ls_std::Long> x = std::make_shared<ls_std::Long>(13);
|
|
|
|
+ ASSERT_EQ(13, *x);
|
|
|
|
+
|
|
|
|
+ auto serializable = std::make_shared<ls_std::SerializableJSONLong>(x);
|
|
|
|
+ x->setSerializable(std::dynamic_pointer_cast<ls_std::ISerializable>(serializable));
|
|
|
|
+
|
|
|
|
+ x->unmarshal(R"({"class":"Long","value":1989})");
|
|
|
|
+
|
|
|
|
+ ASSERT_EQ(1989, *x);
|
|
|
|
+ }
|
|
|
|
+
|
|
// additional functionality
|
|
// additional functionality
|
|
|
|
|
|
TEST_F(LongTest, getValue)
|
|
TEST_F(LongTest, getValue)
|