notSupported.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // ArduinoJson - arduinojson.org
  2. // Copyright Benoit Blanchon 2014-2019
  3. // MIT License
  4. #include <ArduinoJson.h>
  5. #include <catch.hpp>
  6. static void checkNotSupported(const char* input) {
  7. DynamicJsonDocument doc(4096);
  8. DeserializationError error = deserializeMsgPack(doc, input);
  9. REQUIRE(error == DeserializationError::NotSupported);
  10. }
  11. TEST_CASE("deserializeMsgPack() return NotSupported") {
  12. SECTION("bin 8") {
  13. checkNotSupported("\xc4");
  14. }
  15. SECTION("bin 16") {
  16. checkNotSupported("\xc5");
  17. }
  18. SECTION("bin 32") {
  19. checkNotSupported("\xc6");
  20. }
  21. SECTION("ext 8") {
  22. checkNotSupported("\xc7");
  23. }
  24. SECTION("ext 16") {
  25. checkNotSupported("\xc8");
  26. }
  27. SECTION("ext 32") {
  28. checkNotSupported("\xc9");
  29. }
  30. SECTION("fixext 1") {
  31. checkNotSupported("\xd4");
  32. }
  33. SECTION("fixext 2") {
  34. checkNotSupported("\xd5");
  35. }
  36. SECTION("fixext 4") {
  37. checkNotSupported("\xd6");
  38. }
  39. SECTION("fixext 8") {
  40. checkNotSupported("\xd7");
  41. }
  42. SECTION("fixext 16") {
  43. checkNotSupported("\xd8");
  44. }
  45. SECTION("unsupported in array") {
  46. checkNotSupported("\x91\xc4");
  47. }
  48. SECTION("unsupported in map") {
  49. checkNotSupported("\x81\xc4\x00\xA1H");
  50. checkNotSupported("\x81\xA1H\xc4\x00");
  51. }
  52. SECTION("integer as key") {
  53. checkNotSupported("\x81\x01\xA1H");
  54. }
  55. }