99#define ARDUINOJSON_ENABLE_STD_STRING 0
1010
1111#include < ArduinoJson.h>
12- #include < catch.hpp >
12+ #include < doctest.h >
1313
1414#include " Allocators.hpp"
1515#include " Literals.hpp"
@@ -25,47 +25,47 @@ TEST_CASE("string_view") {
2525 JsonDocument doc (&spy);
2626 JsonVariant variant = doc.to <JsonVariant>();
2727
28- SECTION (" deserializeJson()" ) {
28+ SUBCASE (" deserializeJson()" ) {
2929 auto err = deserializeJson (doc, std::string_view (" 123" , 2 ));
3030 REQUIRE (err == DeserializationError::Ok);
3131 REQUIRE (doc.as <int >() == 12 );
3232 }
3333
34- SECTION (" JsonDocument::set()" ) {
34+ SUBCASE (" JsonDocument::set()" ) {
3535 doc.set (std::string_view (" 123" , 2 ));
3636 REQUIRE (doc.as <std::string_view>() == " 12" );
3737 }
3838
39- SECTION (" JsonDocument::operator[]() const" ) {
39+ SUBCASE (" JsonDocument::operator[]() const" ) {
4040 doc[" ab" ] = " Yes" ;
4141 doc[" abc" ] = " No" ;
4242 REQUIRE (doc[std::string_view (" abc" , 2 )] == " Yes" );
4343 }
4444
45- SECTION (" JsonDocument::operator[]()" ) {
45+ SUBCASE (" JsonDocument::operator[]()" ) {
4646 doc[std::string_view (" abc" , 2 )] = " Yes" ;
4747 REQUIRE (doc[" ab" ] == " Yes" );
4848 }
4949
50- SECTION (" JsonVariant::operator==()" ) {
50+ SUBCASE (" JsonVariant::operator==()" ) {
5151 variant.set (" A" );
5252 REQUIRE (variant == std::string_view (" AX" , 1 ));
5353 REQUIRE_FALSE (variant == std::string_view (" BX" , 1 ));
5454 }
5555
56- SECTION (" JsonVariant::operator>()" ) {
56+ SUBCASE (" JsonVariant::operator>()" ) {
5757 variant.set (" B" );
5858 REQUIRE (variant > std::string_view (" AX" , 1 ));
5959 REQUIRE_FALSE (variant > std::string_view (" CX" , 1 ));
6060 }
6161
62- SECTION (" JsonVariant::operator<()" ) {
62+ SUBCASE (" JsonVariant::operator<()" ) {
6363 variant.set (" B" );
6464 REQUIRE (variant < std::string_view (" CX" , 1 ));
6565 REQUIRE_FALSE (variant < std::string_view (" AX" , 1 ));
6666 }
6767
68- SECTION (" String deduplication" ) {
68+ SUBCASE (" String deduplication" ) {
6969 doc.add (std::string_view (" example one" , 7 ));
7070 doc.add (std::string_view (" example two" , 7 ));
7171 doc.add (std::string_view (" example\0 tree" , 12 ));
@@ -78,21 +78,21 @@ TEST_CASE("string_view") {
7878 });
7979 }
8080
81- SECTION (" as<std::string_view>()" ) {
81+ SUBCASE (" as<std::string_view>()" ) {
8282 doc[" s" ] = " Hello World" ;
8383 doc[" i" ] = 42 ;
8484 REQUIRE (doc[" s" ].as <std::string_view>() == std::string_view (" Hello World" ));
8585 REQUIRE (doc[" i" ].as <std::string_view>() == std::string_view ());
8686 }
8787
88- SECTION (" is<std::string_view>()" ) {
88+ SUBCASE (" is<std::string_view>()" ) {
8989 doc[" s" ] = " Hello World" ;
9090 doc[" i" ] = 42 ;
9191 REQUIRE (doc[" s" ].is <std::string_view>() == true );
9292 REQUIRE (doc[" i" ].is <std::string_view>() == false );
9393 }
9494
95- SECTION (" String containing NUL" ) {
95+ SUBCASE (" String containing NUL" ) {
9696 doc.set (" hello\0 world" _s);
9797 REQUIRE (doc.as <std::string_view>().size () == 11 );
9898 REQUIRE (doc.as <std::string_view>() == std::string_view (" hello\0 world" , 11 ));
0 commit comments