tests: More work on error handling

This commit is contained in:
Tibor Nagy
2019-02-24 00:46:26 +01:00
parent 0c539d6e4e
commit 2d027f0771
14 changed files with 126 additions and 52 deletions
+8 -5
View File
@@ -7,11 +7,14 @@ int main(void) {
FILE *f = fopen("stdio/stdio.in", "r");
ERROR_IF(fopen, f, == NULL);
if (fseek(f, 14, SEEK_CUR) < 0) {
puts("fseek error");
exit(EXIT_FAILURE);
}
int status = fseek(f, 14, SEEK_CUR);
ERROR_IF(fseek, status, == -1);
UNEXP_IF(fseek, status, != 0);
char buffer[256];
printf("%s", fgets(buffer, 256, f));
printf("ftell: %ld\n", ftello(f));
off_t pos = ftello(f);
ERROR_IF(ftello, pos, == -1);
printf("ftell: %ld\n", pos);
}