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