MCPcopy Create free account
hub / github.com/IChooseYou/Reclass / buffer_readAs_customStruct

Method buffer_readAs_customStruct

tests/test_provider.cpp:138–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136 }
137
138 void buffer_readAs_customStruct() {
139 struct Pair { uint16_t a; uint16_t b; };
140 QByteArray d(4, '\0');
141 Pair orig{0x1111, 0x2222};
142 std::memcpy(d.data(), &orig, 4);
143 BufferProvider p(d);
144 Pair result = p.readAs<Pair>(0);
145 QCOMPARE(result.a, (uint16_t)0x1111);
146 QCOMPARE(result.b, (uint16_t)0x2222);
147 }
148
149 // ---------------------------------------------------------------
150 // BufferProvider -- readBytes

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected