mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 18:27:37 +02:00
Added support for custom reader classes
This commit is contained in:
@ -5,6 +5,8 @@
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "CustomReader.hpp"
|
||||
|
||||
TEST_CASE("deserializeMsgPack(const std::string&)") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
|
||||
@ -80,3 +82,14 @@ TEST_CASE("deserializeMsgPack(VLA)") {
|
||||
REQUIRE(err == DeserializationError::Ok);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_CASE("deserializeMsgPack(CustomReader)") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
CustomReader reader("\x92\xA5Hello\xA5world");
|
||||
DeserializationError err = deserializeMsgPack(doc, reader);
|
||||
|
||||
REQUIRE(err == DeserializationError::Ok);
|
||||
REQUIRE(doc.size() == 2);
|
||||
REQUIRE(doc[0] == "Hello");
|
||||
REQUIRE(doc[1] == "world");
|
||||
}
|
||||
|
Reference in New Issue
Block a user