File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,9 @@ private slots:
90
90
void tooBigMaps ();
91
91
void illegalSimpleType_data ();
92
92
void illegalSimpleType ();
93
+
94
+ void encodeRaw_data () { tags_data (); }
95
+ void encodeRaw ();
93
96
};
94
97
95
98
#include " tst_encoder.moc"
@@ -619,4 +622,22 @@ void tst_Encoder::illegalSimpleType()
619
622
QCOMPARE (cbor_encode_simple_value (&encoder, type), CborErrorIllegalSimpleType);
620
623
}
621
624
625
+ void tst_Encoder::encodeRaw ()
626
+ {
627
+ QFETCH (QVariant, input);
628
+ QFETCH (QByteArray, output);
629
+
630
+ // just confirm it copies the data
631
+ QByteArray buffer (output.length (), Qt::Uninitialized);
632
+
633
+ uint8_t *bufptr = reinterpret_cast <quint8 *>(buffer.data ());
634
+ CborEncoder encoder;
635
+ cbor_encoder_init (&encoder, bufptr, buffer.length (), 0 );
636
+
637
+ CborError error = cbor_encode_raw (&encoder, reinterpret_cast <quint8 *>(output.data ()),
638
+ output.size ());
639
+ QCOMPARE (error, CborNoError);
640
+ QCOMPARE (buffer, output);
641
+ }
642
+
622
643
QTEST_MAIN (tst_Encoder)
You can’t perform that action at this time.
0 commit comments