| 368 | } |
| 369 | |
| 370 | void TEST_FOR_FAIL_GENERIC(const char* name, const char* str, const char* error1, const char* error2) |
| 371 | { |
| 372 | testsCount[TEST_FAILURE_INDEX]++; |
| 373 | nullres good = nullcCompile(str); |
| 374 | if(!good) |
| 375 | { |
| 376 | char buf[1024]; |
| 377 | strcpy(buf, strstr(nullcGetLastError(), "ERROR:")); |
| 378 | if(memcmp(buf, error1, strlen(error1)) != 0) |
| 379 | { |
| 380 | printf("Failed %s but for wrong reason:\r\n %s\r\nexpected:\r\n %s\r\n", name, buf, error1); |
| 381 | }else{ |
| 382 | char *bufNext = strstr(buf + 1, "ERROR:"); |
| 383 | if(char *lineEnd = strchr(bufNext, '\r')) |
| 384 | *lineEnd = 0; |
| 385 | if(strcmp(error2, bufNext) != 0) |
| 386 | { |
| 387 | printf("Failed %s but for wrong reason:\r\n %s\r\nexpected:\r\n %s\r\n", name, bufNext, error2); |
| 388 | }else{ |
| 389 | testsPassed[TEST_FAILURE_INDEX]++; |
| 390 | } |
| 391 | } |
| 392 | }else{ |
| 393 | printf("Test \"%s\" failed to fail.\r\n", name); |
| 394 | } |
| 395 | } |
no test coverage detected