mirror of
https://github.com/cc65/cc65.git
synced 2024-06-13 19:29:34 +00:00
seek test: Test some additional error cases.
This commit is contained in:
parent
0a7702626f
commit
357d94e834
|
@ -173,6 +173,35 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("NOT OK, no error\n");
|
printf("NOT OK, no error\n");
|
||||||
|
fclose(file);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ProDOS on the Apple II only supports 24-bit file offsets,
|
||||||
|
** so anything beyond that should be an error. I don't know
|
||||||
|
** about other platforms, but I'm guessing no 6502-based
|
||||||
|
** operating systems support 32-bit offsets?
|
||||||
|
*/
|
||||||
|
printf("seeking to position 2^24:\n\t");
|
||||||
|
pos = lseek(fd, 0x1000000L, SEEK_SET);
|
||||||
|
if (pos == -1) {
|
||||||
|
printf("Ok, error %s\n", strerror(errno));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("NOT OK, returned %ld but expected -1\n", pos);
|
||||||
|
fclose(file);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("trying invalid value for whence:\n\t");
|
||||||
|
pos = lseek(fd, 0L, 3);
|
||||||
|
if (pos == -1) {
|
||||||
|
printf("Ok, error %s\n", strerror(errno));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("NOT OK, returned %ld but expected -1\n", pos);
|
||||||
|
fclose(file);
|
||||||
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user