mirror of
				https://github.com/eledio-devices/thirdparty-tinyexpr.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	Fixed right-to-left interpreter and repeated unary operators
This commit is contained in:
		
							
								
								
									
										22
									
								
								test.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								test.c
									
									
									
									
									
								
							| @@ -684,6 +684,17 @@ void test_logic() { | ||||
|             {"0 || 0", 0}, | ||||
|             {"!0", 1}, | ||||
|             {"!1", 0}, | ||||
|             {"!2", 0}, | ||||
|  | ||||
|             {"!-2", 0}, | ||||
|             {"-!2", 0}, | ||||
|             {"!!0", 0}, | ||||
|             {"!!1", 1}, | ||||
|             {"!!2", 1}, | ||||
|             {"!!-2", 1}, | ||||
|             {"!-!2", 1}, | ||||
|             {"-!!2", -1}, | ||||
|             {"--!!2", 1}, | ||||
|  | ||||
|             {"1 < 2", 1}, | ||||
|             {"2 < 2", 0}, | ||||
| @@ -724,6 +735,17 @@ void test_logic() { | ||||
|             {"5+!(5 < 4)+10", 16}, | ||||
|             {"5+!(5 < 4+10)", 5}, | ||||
|             {"!(5+5 < 4)+10", 11}, | ||||
|  | ||||
| #ifdef TE_POW_FROM_RIGHT | ||||
|             {"!0^2", 1}, | ||||
|             {"!0^-1", 0}, | ||||
|             {"-!0^2", -1}, | ||||
| #else | ||||
|             {"!0^2", 1}, | ||||
|             {"!0^-1", 1}, | ||||
|             {"-!0^2", 1}, | ||||
| #endif | ||||
|  | ||||
|     }; | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user