MCPcopy Create free account
hub / github.com/WheretIB/nullc / TEST_FOR_FAIL

Function TEST_FOR_FAIL

tests/TestBase.cpp:349–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349void TEST_FOR_FAIL(const char* name, const char* str, const char* error)
350{
351 testsCount[TEST_FAILURE_INDEX]++;
352 nullres good = nullcCompile(str);
353 if(!good)
354 {
355 char buf[1024];
356 strncpy(buf, strstr(nullcGetLastError(), "ERROR:"), 1023); buf[1023] = 0;
357 if(char *lineEnd = strchr(buf, '\r'))
358 *lineEnd = 0;
359 if(strcmp(error, buf) != 0)
360 {
361 printf("Failed %s but for wrong reason:\r\n %s\r\nexpected:\r\n %s\r\n", name, buf, error);
362 }else{
363 testsPassed[TEST_FAILURE_INDEX]++;
364 }
365 }else{
366 printf("Test \"%s\" failed to fail.\r\n", name);
367 }
368}
369
370void TEST_FOR_FAIL_GENERIC(const char* name, const char* str, const char* error1, const char* error2)
371{

Callers 3

RunParseFailTestsFunction · 0.85
RunCompileFailTestsFunction · 0.85

Calls 5

nullcCompileFunction · 0.85
strstrFunction · 0.85
nullcGetLastErrorFunction · 0.85
strchrFunction · 0.85
strcmpFunction · 0.85

Tested by

no test coverage detected