mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| // ArduinoJson - arduinojson.org
 | |
| // Copyright Benoit Blanchon 2014-2019
 | |
| // MIT License
 | |
| 
 | |
| #include <ArduinoJson.h>
 | |
| #include <catch.hpp>
 | |
| 
 | |
| using namespace ARDUINOJSON_NAMESPACE;
 | |
| 
 | |
| TEST_CASE("ConstRamStringAdapter") {
 | |
|   SECTION("null") {
 | |
|     ConstRamStringAdapter adapter(NULL);
 | |
| 
 | |
|     REQUIRE(adapter.compare("bravo") < 0);
 | |
|     REQUIRE(adapter.compare(NULL) == 0);
 | |
| 
 | |
|     REQUIRE(adapter.equals(NULL));
 | |
|     REQUIRE_FALSE(adapter.equals("charlie"));
 | |
|   }
 | |
| 
 | |
|   SECTION("non-null") {
 | |
|     ConstRamStringAdapter adapter("bravo");
 | |
| 
 | |
|     REQUIRE(adapter.compare(NULL) > 0);
 | |
|     REQUIRE(adapter.compare("alpha") > 0);
 | |
|     REQUIRE(adapter.compare("bravo") == 0);
 | |
|     REQUIRE(adapter.compare("charlie") < 0);
 | |
| 
 | |
|     REQUIRE(adapter.equals("bravo"));
 | |
|     REQUIRE_FALSE(adapter.equals("charlie"));
 | |
|   }
 | |
| }
 | |
| 
 | |
| TEST_CASE("StlString") {
 | |
|   std::string str("bravo");
 | |
|   StlStringAdapter adapter(str);
 | |
| 
 | |
|   REQUIRE(adapter.compare(NULL) > 0);
 | |
|   REQUIRE(adapter.compare("alpha") > 0);
 | |
|   REQUIRE(adapter.compare("bravo") == 0);
 | |
|   REQUIRE(adapter.compare("charlie") < 0);
 | |
| 
 | |
|   REQUIRE(adapter.equals("bravo"));
 | |
|   REQUIRE_FALSE(adapter.equals("charlie"));
 | |
| }
 |