mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			41 lines
		
	
	
		
			831 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			831 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| // ArduinoJson - arduinojson.org
 | |
| // Copyright Benoit Blanchon 2014-2019
 | |
| // MIT License
 | |
| 
 | |
| #include <ArduinoJson/Polyfills/isInteger.hpp>
 | |
| #include <catch.hpp>
 | |
| 
 | |
| using namespace ArduinoJson::Internals;
 | |
| 
 | |
| TEST_CASE("isInteger()") {
 | |
|   SECTION("Null") {
 | |
|     REQUIRE_FALSE(isInteger(NULL));
 | |
|   }
 | |
| 
 | |
|   SECTION("Empty String") {
 | |
|     REQUIRE_FALSE(isInteger(""));
 | |
|   }
 | |
| 
 | |
|   SECTION("FloatNotInteger") {
 | |
|     REQUIRE_FALSE(isInteger("3.14"));
 | |
|     REQUIRE_FALSE(isInteger("-3.14"));
 | |
|     REQUIRE_FALSE(isInteger("+3.14"));
 | |
|   }
 | |
| 
 | |
|   SECTION("Spaces") {
 | |
|     REQUIRE_FALSE(isInteger("42 "));
 | |
|     REQUIRE_FALSE(isInteger(" 42"));
 | |
|   }
 | |
| 
 | |
|   SECTION("Valid") {
 | |
|     REQUIRE(isInteger("42"));
 | |
|     REQUIRE(isInteger("-42"));
 | |
|     REQUIRE(isInteger("+42"));
 | |
|   }
 | |
| 
 | |
|   SECTION("ExtraSign") {
 | |
|     REQUIRE_FALSE(isInteger("--42"));
 | |
|     REQUIRE_FALSE(isInteger("++42"));
 | |
|   }
 | |
| }
 |