mirror of
				https://github.com/eledio-devices/thirdparty-tinyexpr.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	Removed redundant tests.
This commit is contained in:
		
							
								
								
									
										37
									
								
								test.c
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								test.c
									
									
									
									
									
								
							| @@ -123,26 +123,6 @@ test_case errors[] = { | |||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
| const char *nans[] = { |  | ||||||
|     "", |  | ||||||
|     "1+", |  | ||||||
|     "1)", |  | ||||||
|     "(1", |  | ||||||
|     "1**1", |  | ||||||
|     "1*2(+4", |  | ||||||
|     "1*2(1+4", |  | ||||||
|     "a+5", |  | ||||||
|     "A+5", |  | ||||||
|     "Aa+5", |  | ||||||
|     "1^^5", |  | ||||||
|     "1**5", |  | ||||||
|     "sin(cos5", |  | ||||||
|     "5+5error", |  | ||||||
|     "5+5+error", |  | ||||||
| }; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void test_results() { | void test_results() { | ||||||
|     int i; |     int i; | ||||||
|     for (i = 0; i < sizeof(cases) / sizeof(test_case); ++i) { |     for (i = 0; i < sizeof(cases) / sizeof(test_case); ++i) { | ||||||
| @@ -171,6 +151,9 @@ void test_syntax() { | |||||||
|         te_expr *n = te_compile(expr, 0, 0, &err); |         te_expr *n = te_compile(expr, 0, 0, &err); | ||||||
|         lequal(err, e); |         lequal(err, e); | ||||||
|         lok(!n); |         lok(!n); | ||||||
|  |  | ||||||
|  |         const double k = te_interp(expr, 0); | ||||||
|  |         lok(k != k); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -248,26 +231,12 @@ void test_functions() { | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void test_nans() { |  | ||||||
|     int i; |  | ||||||
|     for (i = 0; i < sizeof(nans) / sizeof(const char*); ++i) { |  | ||||||
|         const char *expr = nans[i]; |  | ||||||
|  |  | ||||||
|         int err; |  | ||||||
|         const double r = te_interp(expr, &err); |  | ||||||
|         lok(err); |  | ||||||
|         lok(r != r); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int main(int argc, char *argv[]) | int main(int argc, char *argv[]) | ||||||
| { | { | ||||||
|     lrun("Results", test_results); |     lrun("Results", test_results); | ||||||
|     lrun("Syntax", test_syntax); |     lrun("Syntax", test_syntax); | ||||||
|     lrun("Variables", test_variables); |     lrun("Variables", test_variables); | ||||||
|     lrun("Functions", test_functions); |     lrun("Functions", test_functions); | ||||||
|     lrun("NaNs", test_nans); |  | ||||||
|     lresults(); |     lresults(); | ||||||
|  |  | ||||||
|     return lfails != 0; |     return lfails != 0; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user