tests: Portability fixes, replaced 0/1/-1 return codes with macros

This commit is contained in:
Tibor Nagy
2019-02-20 20:20:07 +01:00
parent ff874c87d7
commit c19cc8b731
76 changed files with 178 additions and 133 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ int main(void) {
long l = a64l(s);
if (l != 194301926) {
printf("Invalid result: a64l(%s) = %ld\n", s, l);
return 1;
return EXIT_FAILURE;
}
printf("Correct a64l: %s = %ld\n", s, l);
@@ -15,8 +15,8 @@ int main(void) {
l = a64l(s);
if (l != 53222) {
printf("Invalid result: a64l(%s) = %ld\n", s, l);
return 1;
return EXIT_FAILURE;
}
printf("Correct a64l: %s = %ld\n", s, l);
return 0;
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -25,5 +25,5 @@ int main(void) {
}
free(ptra);
return 0;
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -4,5 +4,5 @@
int main(void) {
double d = atof("-3.14");
printf("%f\n", d);
return 0;
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -8,5 +8,5 @@ int main(void) {
printf("%ld\n", atol(" -42"));
printf("%ld\n", atol(" +555"));
printf("%ld\n", atol(" 1234567890 "));
return 0;
return EXIT_SUCCESS;
}
+2 -2
View File
@@ -13,7 +13,7 @@ int int_cmp(const void* a, const void* b) {
size_t i = 0; \
for (; i < len; ++i) printf("%d,", arr[i]); \
printf("] expected %p but got %p\n", (void*) expect, res); \
return 1; \
return EXIT_FAILURE; \
} \
} while (0);
@@ -53,5 +53,5 @@ int main(void) {
BSEARCH_TEST_INT(x, big, 7, NULL);
printf("PASS bsearch\n");
return 0;
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -18,6 +18,6 @@ int main(void) {
_Exit(0);
;
return 0;
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -34,7 +34,7 @@ int main(void) {
if (env) {
puts("This should be null, but isn't");
puts(env);
return 1;
return EXIT_FAILURE;
} else {
puts("Value deleted successfully!");
}
+1 -1
View File
@@ -23,5 +23,5 @@ int main(void) {
}
fclose(fp);
remove(file_name);
return 0;
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -8,5 +8,5 @@ int main(void) {
mktemp(string);
printf("%s\n",string);
free(string);
return 0;
return EXIT_SUCCESS;
}
+2 -2
View File
@@ -8,7 +8,7 @@ int main(void) {
char* path = realpath("stdlib/realpath.c", NULL);
if (!path) {
perror("realpath");
return -1;
return EXIT_FAILURE;
}
puts(path);
@@ -21,7 +21,7 @@ int main(void) {
if (!path) {
perror("realpath");
free(path);
return -1;
return EXIT_FAILURE;
}
puts(path);
+1 -1
View File
@@ -27,5 +27,5 @@ int main(void) {
printf("errno is not 0 (%d), something went wrong\n", errno);
}
return 0;
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -26,5 +26,5 @@ int main(void) {
printf("errno is not 0 (%d), something went wrong\n", errno);
}
return 0;
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -2,5 +2,5 @@
int main(void) {
system("echo test of system");
return 0;
return EXIT_SUCCESS;
}