tests: Portability fixes, replaced 0/1/-1 return codes with macros
This commit is contained in:
+3
-3
@@ -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;
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ int main(void) {
|
||||
}
|
||||
free(ptra);
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,5 +4,5 @@
|
||||
int main(void) {
|
||||
double d = atof("-3.14");
|
||||
printf("%f\n", d);
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
@@ -18,6 +18,6 @@ int main(void) {
|
||||
_Exit(0);
|
||||
|
||||
;
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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!");
|
||||
}
|
||||
|
||||
@@ -23,5 +23,5 @@ int main(void) {
|
||||
}
|
||||
fclose(fp);
|
||||
remove(file_name);
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ int main(void) {
|
||||
mktemp(string);
|
||||
printf("%s\n",string);
|
||||
free(string);
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -27,5 +27,5 @@ int main(void) {
|
||||
printf("errno is not 0 (%d), something went wrong\n", errno);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -26,5 +26,5 @@ int main(void) {
|
||||
printf("errno is not 0 (%d), something went wrong\n", errno);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
int main(void) {
|
||||
system("echo test of system");
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user