add support for seeking to the end of a file

This commit is contained in:
Axel Kohlmeyer
2021-10-05 15:44:58 -04:00
parent 741cf9c7d5
commit af070aa351
3 changed files with 16 additions and 3 deletions

View File

@ -170,7 +170,9 @@ TEST(Platform, fseek_ftell)
ASSERT_EQ(platform::fseek(fp, 15), 0);
ASSERT_EQ(fgetc(fp), '6');
fflush(fp);
fseek(fp, -1, SEEK_END);
ASSERT_EQ(platform::fseek(fp, platform::END_OF_FILE), 0);
ASSERT_EQ(platform::ftell(fp), 21);
ASSERT_EQ(platform::fseek(fp, 20), 0);
ASSERT_EQ(fgetc(fp), 0);
ASSERT_EQ(platform::ftell(fp), 21);
fclose(fp);