From a5b4689fd2be881e28c64cf998ebecb6386563a2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 29 Apr 2007 07:44:02 +0000 Subject: [PATCH] Oops, fix details and comments of last patch. --- tests/test-freading.c | 6 ++++-- tests/test-fwriting.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test-freading.c b/tests/test-freading.c index e51d7ab18..3d69c404e 100644 --- a/tests/test-freading.c +++ b/tests/test-freading.c @@ -73,6 +73,7 @@ main () freading is only deterministic after input or output, but this test case should be portable even on open, after reposition, and at EOF. */ + /* First a scenario with only fgetc, fseek, fputc. */ fp = fopen (TESTFILE, "r+"); if (fp == NULL) goto skip; @@ -91,7 +92,7 @@ main () if (fseek (fp, 0, SEEK_CUR) != 0) goto skip; /* freading (fp) is undefined here, but fwriting (fp) is false. */ - if (fputc ('z', fp) != 'z') + if (fputc ('x', fp) != 'x') goto skip; ASSERT (!freading (fp)); if (fseek (fp, 0, SEEK_END)) @@ -105,6 +106,7 @@ main () freading is only deterministic after input or output, but this test case should be portable even on open, after reposition, and at EOF. */ + /* Here a scenario that includes fflush. */ fp = fopen (TESTFILE, "r+"); if (fp == NULL) goto skip; @@ -120,7 +122,7 @@ main () ASSERT (freading (fp)); fflush (fp); /* freading (fp) is undefined here, but fwriting (fp) is false. */ - if (fgetc (fp) != 'a') + if (fgetc (fp) != 'x') goto skip; ASSERT (freading (fp)); /* This fseek call is necessary when switching from reading to writing. diff --git a/tests/test-fwriting.c b/tests/test-fwriting.c index 00b6870b4..690a35f30 100644 --- a/tests/test-fwriting.c +++ b/tests/test-fwriting.c @@ -73,6 +73,7 @@ main () fwriting is only deterministic after input or output, but this test case should be portable even on open, after reposition, and after fflush. */ + /* First a scenario with only fgetc, fseek, fputc. */ fp = fopen (TESTFILE, "r+"); if (fp == NULL) goto skip; @@ -91,7 +92,7 @@ main () if (fseek (fp, 0, SEEK_CUR) != 0) goto skip; ASSERT (!fwriting (fp)); - if (fputc ('z', fp) != 'z') + if (fputc ('x', fp) != 'x') goto skip; ASSERT (fwriting (fp)); if (fseek (fp, 0, SEEK_END)) @@ -105,6 +106,7 @@ main () fwriting is only deterministic after input or output, but this test case should be portable even on open, after reposition, and after fflush. */ + /* Here a scenario that includes fflush. */ fp = fopen (TESTFILE, "r+"); if (fp == NULL) goto skip; @@ -120,7 +122,7 @@ main () ASSERT (!fwriting (fp)); fflush (fp); ASSERT (!fwriting (fp)); - if (fgetc (fp) != 'a') + if (fgetc (fp) != 'x') goto skip; ASSERT (!fwriting (fp)); /* This fseek call is necessary when switching from reading to writing. -- 2.11.0