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 @@ -77,6 +77,9 @@ private slots:
77
77
void tooBigMaps ();
78
78
void illegalSimpleType_data ();
79
79
void illegalSimpleType ();
80
+
81
+ void encodeRaw_data () { tags_data (); }
82
+ void encodeRaw ();
80
83
};
81
84
82
85
#include " tst_encoder.moc"
@@ -606,4 +609,22 @@ void tst_Encoder::illegalSimpleType()
606
609
QCOMPARE (cbor_encode_simple_value (&encoder, type), CborErrorIllegalSimpleType);
607
610
}
608
611
612
+ void tst_Encoder::encodeRaw ()
613
+ {
614
+ QFETCH (QVariant, input);
615
+ QFETCH (QByteArray, output);
616
+
617
+ // just confirm it copies the data
618
+ QByteArray buffer (output.length (), Qt::Uninitialized);
619
+
620
+ uint8_t *bufptr = reinterpret_cast <quint8 *>(buffer.data ());
621
+ CborEncoder encoder;
622
+ cbor_encoder_init (&encoder, bufptr, buffer.length (), 0 );
623
+
624
+ CborError error = cbor_encode_raw (&encoder, reinterpret_cast <quint8 *>(output.data ()),
625
+ output.size ());
626
+ QCOMPARE (error, CborNoError);
627
+ QCOMPARE (buffer, output);
628
+ }
629
+
609
630
QTEST_MAIN (tst_Encoder)
You can’t perform that action at this time.
0 commit comments