Jelajahi Sumber

Complete migration to explicit types

- Migrate to explicit sint32/64 type
TODO: create common serializaers/deserializers
Alexey Edelev 6 tahun lalu
induk
melakukan
771943fea1

+ 46 - 82
src/protobuf/protobufobject.cpp

@@ -29,20 +29,6 @@ using namespace qtprotobuf;
 
 ProtobufObjectPrivate::SerializerRegistry ProtobufObjectPrivate::serializers = {};
 
-namespace {
-    static const char *sint32TypeNameP = "qtprotobuf::sint32";
-    static const char *sint32TypeName = "sint32";
-
-    static const char *sint64TypeNameP = "qtprotobuf::sint64";
-    static const char *sint64TypeName = "sint64";
-
-    static const char *sint32ListTypeNameP = "qtprotobuf::sint32List";
-    static const char *sint32ListTypeName = "sint32List";
-
-    static const char *sint64ListTypeNameP = "qtprotobuf::sint64List";
-    static const char *sint64ListTypeName = "sint64List";
-}
-
 QByteArray ProtobufObjectPrivate::serializeValue(const QVariant &propertyValue, int fieldIndex, const QMetaProperty &metaProperty)
 {
     QLatin1Literal typeName(metaProperty.typeName());
@@ -52,26 +38,34 @@ QByteArray ProtobufObjectPrivate::serializeValue(const QVariant &propertyValue,
                   << typeName << static_cast<QMetaType::Type>(propertyValue.type());
 
     switch (static_cast<QMetaType::Type>(propertyValue.type())) {
+    case QMetaType::Long:
     case QMetaType::Int:
         type = Varint;
-        if (typeName == sint32TypeNameP
-                || typeName == sint32TypeName) {
-            result.append(serializeVarintZigZag(propertyValue.toInt()));
-        } else {
-            result.append(serializeVarint(propertyValue.toLongLong()));
-        }
+        //FIXME:
+        //Serialize to int64_t bacause of issue in reference implementation
+        result.append(serializeVarint(propertyValue.value<int64_t>()));
         if (0 == result.size()) {
             fieldIndex = NotUsedFieldIndex;
         }
         break;
     case QMetaType::LongLong:
         type = Varint;
-        if (typeName == sint64TypeNameP
-                || typeName == sint64TypeName) {
-            result.append(serializeVarintZigZag(propertyValue.toLongLong()));
-        } else {
-            result.append(serializeVarint(propertyValue.toLongLong()));
+        result.append(serializeVarint(propertyValue.value<int64_t>()));
+        if (0 == result.size()) {
+            fieldIndex = NotUsedFieldIndex;
         }
+        break;
+    case QMetaType::ULong:
+    case QMetaType::UInt:
+        type = Varint;
+        result.append(serializeVarint(propertyValue.value<uint32_t>()));
+        if (0 == result.size()) {
+            fieldIndex = NotUsedFieldIndex;
+        }
+        break;
+    case QMetaType::ULongLong:
+        type = Varint;
+        result.append(serializeVarint(propertyValue.value<uint64_t>()));
         if (0 == result.size()) {
             fieldIndex = NotUsedFieldIndex;
         }
@@ -108,20 +102,6 @@ QByteArray ProtobufObjectPrivate::serializeValue(const QVariant &propertyValue,
             result.append(serializeUserType(propertyValue, fieldIndex, typeName, type));
         }
         break;
-    case QMetaType::UInt:
-        type = Varint;
-        result.append(serializeVarint(propertyValue.toUInt()));
-        if (0 == result.size()) {
-            fieldIndex = NotUsedFieldIndex;
-        }
-        break;
-    case QMetaType::ULongLong:
-        type = Varint;
-        result.append(serializeVarint(propertyValue.toULongLong()));
-        if (0 == result.size()) {
-            fieldIndex = NotUsedFieldIndex;
-        }
-        break;
     case QMetaType::Bool:
         type = Varint;
         result.append(serializeVarint(propertyValue.toUInt()));
@@ -153,6 +133,14 @@ QByteArray ProtobufObjectPrivate::serializeUserType(const QVariant &propertyValu
     }
 
     //Check if it's special type
+    if (userType == qMetaTypeId<sint32>()) {
+        type = Varint;
+        return serializeVarintZigZag(propertyValue.value<sint32>());
+    }
+    if (userType == qMetaTypeId<sint64>()) {
+        type = Varint;
+        return serializeVarintZigZag(propertyValue.value<sint64>());
+    }
     if (userType == qMetaTypeId<fint32>()) {
         type = Fixed32;
         return serializeFixed(propertyValue.value<fint32>());
@@ -181,35 +169,27 @@ QByteArray ProtobufObjectPrivate::serializeUserType(const QVariant &propertyValu
     if (userType == qMetaTypeId<sfint64List>()) {
         return serializeListType(propertyValue.value<sfint64List>(), fieldIndex);
     }
-
     if (userType == qMetaTypeId<int32List>()) {
-        if (typeName == sint32ListTypeNameP
-                || typeName == sint32ListTypeName) {
-            return serializeListTypeZigZag(propertyValue.value<sint32List>(), fieldIndex);
-        }
         return serializeListType(propertyValue.value<int32List>(), fieldIndex);
     }
-
-    if (userType == qMetaTypeId<uint32List>()) {
-        return serializeListType(propertyValue.value<uint32List>(), fieldIndex);
-    }
-
     if (userType == qMetaTypeId<int64List>()) {
-        if (typeName == sint64ListTypeNameP
-                || typeName == sint64ListTypeName) {
-            return serializeListTypeZigZag(propertyValue.value<sint64List>(), fieldIndex);
-        }
         return serializeListType(propertyValue.value<int64List>(), fieldIndex);
     }
-
+    if (userType == qMetaTypeId<sint32List>()) {
+        return serializeListTypeZigZag(propertyValue.value<sint32List>(), fieldIndex);
+    }
+    if (userType == qMetaTypeId<sint64List>()) {
+        return serializeListTypeZigZag(propertyValue.value<sint64List>(), fieldIndex);
+    }
+    if (userType == qMetaTypeId<uint32List>()) {
+        return serializeListType(propertyValue.value<uint32List>(), fieldIndex);
+    }
     if (userType == qMetaTypeId<uint64List>()) {
         return serializeListType(propertyValue.value<uint64List>(), fieldIndex);
     }
-
     if (userType == qMetaTypeId<FloatList>()) {
         return serializeListType(propertyValue.value<FloatList>(), fieldIndex);
     }
-
     if (userType == qMetaTypeId<DoubleList>()) {
         return serializeListType(propertyValue.value<DoubleList>(), fieldIndex);
     }
@@ -237,22 +217,10 @@ void ProtobufObjectPrivate::deserializeProperty(WireTypes wireType, const QMetaP
         newPropertyValue = deserializeFixed<double>(it);
         break;
     case QMetaType::Int:
-        if (typeName == sint32TypeNameP
-                   || typeName == sint32TypeName) {
-            newPropertyValue = deserializeVarintZigZag<sint32>(it);
-        } else {
-            newPropertyValue = deserializeVarint<int64>(it);
-        }
+        newPropertyValue = deserializeVarint<int64>(it);
         break;
     case QMetaType::LongLong:
-        if (wireType == Fixed64) {
-            newPropertyValue = deserializeFixed<sfint64>(it);
-        } else if (typeName == sint64TypeNameP
-                   || typeName == sint64TypeName) {
-            newPropertyValue = deserializeVarintZigZag<sint64>(it);
-        } else {
-            newPropertyValue = deserializeVarint<int64>(it);
-        }
+        newPropertyValue = deserializeVarint<int64>(it);
         break;
     case QMetaType::QString:
         newPropertyValue = QString::fromUtf8(deserializeLengthDelimited(it));
@@ -302,6 +270,8 @@ void ProtobufObjectPrivate::deserializeUserType(const QMetaProperty &metaType, Q
     }
 
     if (userType == qMetaTypeId<fint32>()) {
+        newValue = deserializeVarintZigZag<sint32>(it);
+    } else if (userType == qMetaTypeId<fint32>()) {
         newValue = deserializeFixed<fint32>(it);
     } else if (userType == qMetaTypeId<fint64>()) {
         newValue = deserializeFixed<fint64>(it);
@@ -318,19 +288,13 @@ void ProtobufObjectPrivate::deserializeUserType(const QMetaProperty &metaType, Q
     } else if(userType == qMetaTypeId<sfint64List>()) {
         newValue = deserializeListType<sfint64>(it);
     } else if (userType == qMetaTypeId<int32List>()) {
-        if (typeName == sint32ListTypeNameP
-                || typeName == sint32ListTypeName) {
-            newValue = deserializeVarintListTypeZigZag<int32>(it);
-        } else {
-            newValue = deserializeVarintListType<int32>(it);
-        }
+        newValue = deserializeVarintListType<int32>(it);
     } else if (userType == qMetaTypeId<int64List>()) {
-        if (typeName == sint64ListTypeNameP
-                || typeName == sint64ListTypeName) {
-            newValue = deserializeVarintListTypeZigZag<int64>(it);
-        } else {
-            newValue = deserializeVarintListType<int64>(it);
-        }
+        newValue = deserializeVarintListType<int64>(it);
+    } else if (userType == qMetaTypeId<sint32List>()) {
+        newValue = deserializeVarintListTypeZigZag<sint32>(it);
+    } else if (userType == qMetaTypeId<sint64List>()) {
+        newValue = deserializeVarintListTypeZigZag<sint64>(it);
     } else if (userType == qMetaTypeId<uint32List>()) {
         newValue = deserializeVarintListType<uint32>(it);
     } else if (userType == qMetaTypeId<uint64List>()) {

+ 23 - 12
src/protobuf/protobufobject_p.h

@@ -51,6 +51,15 @@ enum WireTypes {
     Fixed32 = 5
 };
 
+template<typename V>
+struct make_unsigned { typedef typename std::make_unsigned<V>::type type; };
+
+template<>
+struct make_unsigned<sint32> { typedef typename std::make_unsigned<decltype(sint32::_t)>::type type; };
+
+template<>
+struct make_unsigned<sint64> { typedef typename std::make_unsigned<decltype(sint64::_t)>::type type; };
+
 constexpr int NotUsedFieldIndex = -1;
 
 class ProtobufObjectPrivate : public QObject
@@ -96,7 +105,8 @@ public:
     }
 
     template<typename V,
-             typename std::enable_if_t<std::is_signed<V>::value, int> = 0>
+             typename std::enable_if_t<std::is_same<sint32, V>::value
+                                       || std::is_same<sint64, V>::value, int> = 0>
     static QByteArray serializeListTypeZigZag(const QList<V> &listValue, int &outFieldIndex) {
         qProtoDebug() << __func__ << "listValue.count" << listValue.count() << "outFiledIndex" << outFieldIndex;
 
@@ -115,7 +125,8 @@ public:
     }
 
     template<typename V,
-             typename std::enable_if_t<std::is_integral<V>::value, int> = 0>
+             typename std::enable_if_t<std::is_same<V, int32>::value
+                                       || std::is_integral<V>::value, int> = 0>
     static QByteArray serializeListType(const QList<V> &listValue, int &outFieldIndex) {
         qProtoDebug() << __func__ << "listValue.count" << listValue.count() << "outFiledIndex" << outFieldIndex;
 
@@ -125,10 +136,8 @@ public:
         }
 
         QByteArray serializedList;
-        std::function<QByteArray(V)> serializer;
-        serializer = ProtobufObjectPrivate::serializeVarint<V>;
         for (auto &value : listValue) {
-            serializedList.append(serializer(value));
+            serializedList.append(serializeVarint<V>(value));
         }
         //If internal field type is not LengthDelimited, exact amount of fields to be specified
         serializedList.prepend(serializeVarintZero(static_cast<unsigned int>(serializedList.size())));
@@ -216,7 +225,7 @@ public:
         return result;
     }
 
-    template <typename V, typename UV = typename std::make_unsigned<V>::type,
+    template <typename V, typename UV = typename qtprotobuf::make_unsigned<V>::type,
               typename std::enable_if_t<std::is_signed<V>::value, int> = 0>
     static QByteArray serializeVarint(V value) {
         qProtoDebug() << __func__ << "value" << value;
@@ -224,8 +233,9 @@ public:
         return serializeVarint(static_cast<UV>(value));
     }
 
-    template <typename V, typename UV = typename std::make_unsigned<V>::type,
-              typename std::enable_if_t<std::is_signed<V>::value, int> = 0>
+    template <typename V, typename UV = typename qtprotobuf::make_unsigned<V>::type,
+              typename std::enable_if_t<std::is_same<V, sint32>::value
+                                        || std::is_same<V, sint64>::value, int> = 0>
     static QByteArray serializeVarintZigZag(V value) {
         qProtoDebug() << __func__ << "value" << value;
 
@@ -301,17 +311,18 @@ public:
         return QVariant::fromValue(deserializeVarintCommon<V>(it));
     }
 
-    template <typename V, typename UV = typename std::make_unsigned<V>::type,
-              typename std::enable_if_t<std::is_signed<V>::value, int> = 0>
+    template <typename V, typename UV = typename qtprotobuf::make_unsigned<V>::type,
+              typename std::enable_if_t<std::is_same<sint32, V>::value
+                                        || std::is_same<sint64, V>::value,int> = 0>
     QVariant deserializeVarintZigZag(QByteArray::const_iterator &it) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         UV unsignedValue = deserializeVarintCommon<UV>(it);
         V value = (unsignedValue >> 1) ^ (-(unsignedValue & 1));
-        return QVariant::fromValue(value);
+        return QVariant::fromValue<V>(value);
     }
 
-    template <typename V, typename UV = typename std::make_unsigned<V>::type,
+    template <typename V, typename UV = typename qtprotobuf::make_unsigned<V>::type,
               typename std::enable_if_t<std::is_signed<V>::value, int> = 0>
     QVariant deserializeVarint(QByteArray::const_iterator &it) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);

+ 15 - 11
src/protobuf/qtprotobuftypes.h

@@ -29,7 +29,7 @@
 #include <QList>
 #include <QMetaType>
 
-template<typename T>
+template<typename T, int = 0>
 struct transparent {
     transparent(T t = T()) : _t(t){}
     T _t;
@@ -38,16 +38,16 @@ struct transparent {
 };
 
 namespace qtprotobuf {
-using int32 = int;
-using int64 = qlonglong;
-using uint32 = unsigned int;
-using uint64 = qulonglong;
-using sint32 = int;
-using sint64 = qlonglong;
-using fint32 = transparent<uint32_t>;
-using fint64 = transparent<uint64_t>;
-using sfint32 = transparent<int32_t>;
-using sfint64 = transparent<int64_t>;
+using int32 = int32_t;
+using int64 = int64_t;
+using uint32 = uint32_t;
+using uint64 = uint64_t;
+using sint32 = transparent<int32_t>;
+using sint64 = transparent<int64_t>;
+using fint32 = transparent<uint32_t, 1>;
+using fint64 = transparent<uint64_t, 1>;
+using sfint32 = transparent<int32_t, 1>;
+using sfint64 = transparent<int64_t, 1>;
 
 using int32List = QList<int32>;
 using int64List = QList<int64>;
@@ -66,6 +66,8 @@ using DoubleList = QList<double>;
 
 Q_DECLARE_METATYPE(qtprotobuf::int32)
 Q_DECLARE_METATYPE(qtprotobuf::int64)
+Q_DECLARE_METATYPE(qtprotobuf::sint32)
+Q_DECLARE_METATYPE(qtprotobuf::sint64)
 Q_DECLARE_METATYPE(qtprotobuf::uint32)
 Q_DECLARE_METATYPE(qtprotobuf::uint64)
 Q_DECLARE_METATYPE(qtprotobuf::fint32)
@@ -75,6 +77,8 @@ Q_DECLARE_METATYPE(qtprotobuf::sfint64)
 
 Q_DECLARE_METATYPE(qtprotobuf::int32List)
 Q_DECLARE_METATYPE(qtprotobuf::int64List)
+Q_DECLARE_METATYPE(qtprotobuf::sint32List)
+Q_DECLARE_METATYPE(qtprotobuf::sint64List)
 Q_DECLARE_METATYPE(qtprotobuf::uint32List)
 Q_DECLARE_METATYPE(qtprotobuf::uint64List)
 Q_DECLARE_METATYPE(qtprotobuf::fint32List)

+ 1 - 1
tests/proto/simpletest.proto

@@ -170,7 +170,7 @@ message RepeatedSFixedInt64Message {
 }
 
 message SimpleSInt32MapMessage {
-    map<sint32, SimpleStringMessage> mapField = 1;
+    map<fixed32, SimpleStringMessage> mapField = 1;
 }
 
 message SimpleStringMapMessage {

+ 19 - 19
tests/simpletest.cpp

@@ -87,7 +87,7 @@ TEST_F(SimpleTest, SimpleBoolMessageTest)
     SimpleBoolMessage test;
     int propertyNumber = SimpleBoolMessage::propertyOrdering.at(1); //See simpletest.proto
     ASSERT_STREQ(SimpleBoolMessage::staticMetaObject.property(propertyNumber).typeName(), "bool");
-    ASSERT_EQ(SimpleBoolMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<bool>());
+    ASSERT_EQ(SimpleBoolMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<bool>());
     ASSERT_STREQ(SimpleBoolMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
     ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(true)));
     ASSERT_EQ(test.property(propertyName).toBool(), true);
@@ -100,10 +100,10 @@ TEST_F(SimpleTest, SimpleIntMessageTest)
     SimpleIntMessage test;
     int propertyNumber = SimpleIntMessage::propertyOrdering.at(1); //See simpletest.proto
     ASSERT_STREQ(SimpleIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int32");
-    ASSERT_EQ(SimpleIntMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<int32>());
+    ASSERT_EQ(SimpleIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<int32>());
     ASSERT_STREQ(SimpleIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
-    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
-    ASSERT_EQ(test.property(propertyName).toInt(), 1);
+    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int32>(1)));
+    ASSERT_EQ(test.property(propertyName).value<int32>(), 1);
     ASSERT_EQ(test.testFieldInt(), 1);
 }
 
@@ -113,10 +113,10 @@ TEST_F(SimpleTest, SimpleSIntMessageTest)
     SimpleSIntMessage test;
     int propertyNumber = SimpleSIntMessage::propertyOrdering.at(1); //See simpletest.proto
     ASSERT_STREQ(SimpleSIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sint32");
-    ASSERT_EQ(SimpleSIntMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<sint32>());
+    ASSERT_EQ(SimpleSIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<sint32>());
     ASSERT_STREQ(SimpleSIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
-    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
-    ASSERT_EQ(test.property(propertyName).toInt(), 1);
+    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sint32>(1)));
+    ASSERT_EQ(test.property(propertyName).value<sint32>(), 1);
     ASSERT_EQ(test.testFieldInt(), 1);
 }
 
@@ -126,10 +126,10 @@ TEST_F(SimpleTest, SimpleUIntMessageTest)
     SimpleUIntMessage test;
     int propertyNumber = SimpleUIntMessage::propertyOrdering.at(1); //See simpletest.proto
     ASSERT_STREQ(SimpleUIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::uint32");
-    ASSERT_EQ(SimpleUIntMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<uint32>());
+    ASSERT_EQ(SimpleUIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<uint32>());
     ASSERT_STREQ(SimpleUIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
-    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
-    ASSERT_EQ(test.property(propertyName).toInt(), 1);
+    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<uint32>(1)));
+    ASSERT_EQ(test.property(propertyName).value<uint32>(), 1);
     ASSERT_EQ(test.testFieldInt(), 1);
 }
 
@@ -139,10 +139,10 @@ TEST_F(SimpleTest, SimpleInt64MessageTest)
     SimpleInt64Message test;
     int propertyNumber = SimpleInt64Message::propertyOrdering.at(1); //See simpletest.proto
     ASSERT_STREQ(SimpleInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int64");
-    ASSERT_EQ(SimpleInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<int64>());
+    ASSERT_EQ(SimpleInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<int64>());
     ASSERT_STREQ(SimpleInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
-    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
-    ASSERT_EQ(test.property(propertyName).toInt(), 1);
+    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int64>(1)));
+    ASSERT_EQ(test.property(propertyName).value<int64>(), 1);
     ASSERT_EQ(test.testFieldInt(), 1);
 }
 
@@ -152,10 +152,10 @@ TEST_F(SimpleTest, SimpleSInt64MessageTest)
     SimpleSInt64Message test;
     int propertyNumber = SimpleSInt64Message::propertyOrdering.at(1); //See simpletest.proto
     ASSERT_STREQ(SimpleSInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sint64");
-    ASSERT_EQ(SimpleSInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<sint64>());
+    ASSERT_EQ(SimpleSInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<sint64>());
     ASSERT_STREQ(SimpleSInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
-    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
-    ASSERT_EQ(test.property(propertyName).toInt(), 1);
+    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sint64>(1)));
+    ASSERT_EQ(test.property(propertyName).value<sint64>(), 1);
     ASSERT_EQ(test.testFieldInt(), 1);
 }
 
@@ -165,10 +165,10 @@ TEST_F(SimpleTest, SimpleUInt64MessageTest)
     SimpleUInt64Message test;
     int propertyNumber = SimpleUInt64Message::propertyOrdering.at(1); //See simpletest.proto
     ASSERT_STREQ(SimpleUInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::uint64");
-    ASSERT_EQ(SimpleUInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<uint64>());
+    ASSERT_EQ(SimpleUInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<uint64>());
     ASSERT_STREQ(SimpleUInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
-    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
-    ASSERT_EQ(test.property(propertyName).toInt(), 1);
+    ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<uint64>(1)));
+    ASSERT_EQ(test.property(propertyName).value<uint64>(), 1);
     ASSERT_EQ(test.testFieldInt(), 1);
 }