@@ -64,6 +64,7 @@ public:
6464 void test36();
6565 void test37();
6666 void test38();
67+ void test39();
6768
6869private:
6970 template <typename TField>
@@ -2253,6 +2254,35 @@ void FieldsTestSuite2::test38()
22532254 // field.setBitValue(1, true); // Must fail compilation
22542255}
22552256
2257+ void FieldsTestSuite2::test39()
2258+ {
2259+ typedef comms::field::IntValue<
2260+ comms::Field<BigEndianOpt>,
2261+ std::int16_t,
2262+ comms::option::VarLength<1, 4>,
2263+ comms::option::NumValueSerOffset<-1900>
2264+ > Field;
2265+
2266+ static_assert(!Field::isVersionDependent(), "Invalid version dependency assumption");
2267+
2268+ static const char Buf[] = {
2269+ static_cast<char>(0x81), 0x00,
2270+ };
2271+ static const std::size_t BufSize = std::extent<decltype(Buf)>::value;
2272+ auto field = readWriteField<Field>(Buf, BufSize);
2273+
2274+ TS_ASSERT_EQUALS(field.length(), 2);
2275+ TS_ASSERT_EQUALS(field.value(), 2028);
2276+ TS_ASSERT(field.valid());
2277+
2278+ field.value() = 2030;
2279+ static const char ExpectedBuf[] = {
2280+ static_cast<char>(0x81), 0x02,
2281+ };
2282+ const std::size_t ExpectedBufSize = std::extent<decltype(ExpectedBuf)>::value;
2283+ writeReadField(field, ExpectedBuf, ExpectedBufSize);
2284+ }
2285+
22562286template <typename TField>
22572287void FieldsTestSuite2::writeField(
22582288 const TField& field,
0 commit comments