Encoder: add unit test for cbor_encode_raw

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
diff --git a/tests/encoder/tst_encoder.cpp b/tests/encoder/tst_encoder.cpp
index 31c2915..9e683f4 100644
--- a/tests/encoder/tst_encoder.cpp
+++ b/tests/encoder/tst_encoder.cpp
@@ -77,6 +77,9 @@
     void tooBigMaps();
     void illegalSimpleType_data();
     void illegalSimpleType();
+
+    void encodeRaw_data() { tags_data(); }
+    void encodeRaw();
 };
 
 #include "tst_encoder.moc"
@@ -606,4 +609,22 @@
     QCOMPARE(cbor_encode_simple_value(&encoder, type), CborErrorIllegalSimpleType);
 }
 
+void tst_Encoder::encodeRaw()
+{
+    QFETCH(QVariant, input);
+    QFETCH(QByteArray, output);
+
+    // just confirm it copies the data
+    QByteArray buffer(output.length(), Qt::Uninitialized);
+
+    uint8_t *bufptr = reinterpret_cast<quint8 *>(buffer.data());
+    CborEncoder encoder;
+    cbor_encoder_init(&encoder, bufptr, buffer.length(), 0);
+
+    CborError error = cbor_encode_raw(&encoder, reinterpret_cast<quint8 *>(output.data()),
+                                      output.size());
+    QCOMPARE(error, CborNoError);
+    QCOMPARE(buffer, output);
+}
+
 QTEST_MAIN(tst_Encoder)