Lines Matching refs:fp
37 FILE* fp = fopen("/proc/version", "r"); in TEST() local
40 ASSERT_EQ(0U, __fbufsize(fp)); in TEST()
44 fgets(buf, sizeof(buf), fp); in TEST()
45 ASSERT_EQ(1024U, __fbufsize(fp)); in TEST()
47 ASSERT_EQ(0, setvbuf(fp, buf, _IOFBF, 1)); in TEST()
48 ASSERT_EQ(1U, __fbufsize(fp)); in TEST()
50 ASSERT_EQ(0, setvbuf(fp, buf, _IOFBF, 8)); in TEST()
51 ASSERT_EQ(8U, __fbufsize(fp)); in TEST()
53 fclose(fp); in TEST()
57 FILE* fp = fopen("/proc/version", "r"); in TEST() local
59 ASSERT_FALSE(__flbf(fp)); in TEST()
62 ASSERT_EQ(0, setvbuf(fp, buf, _IOLBF, sizeof(buf))); in TEST()
64 ASSERT_TRUE(__flbf(fp)); in TEST()
66 fclose(fp); in TEST()
70 FILE* fp = fopen("/dev/null", "w"); in TEST() local
71 ASSERT_EQ(0U, __fpending(fp)); in TEST()
72 ASSERT_EQ('x', fputc('x', fp)); in TEST()
73 ASSERT_EQ(1U, __fpending(fp)); in TEST()
74 ASSERT_EQ('y', fputc('y', fp)); in TEST()
75 ASSERT_EQ(2U, __fpending(fp)); in TEST()
76 fflush(fp); in TEST()
77 ASSERT_EQ(0U, __fpending(fp)); in TEST()
78 fclose(fp); in TEST()
82 FILE* fp = tmpfile(); in TEST() local
84 ASSERT_EQ('a', fputc('a', fp)); in TEST()
85 ASSERT_EQ(1U, __fpending(fp)); in TEST()
86 __fpurge(fp); in TEST()
87 ASSERT_EQ(0U, __fpending(fp)); in TEST()
89 ASSERT_EQ('b', fputc('b', fp)); in TEST()
90 ASSERT_EQ('\n', fputc('\n', fp)); in TEST()
91 ASSERT_EQ(2U, __fpending(fp)); in TEST()
93 rewind(fp); in TEST()
96 char* s = fgets(buf, sizeof(buf), fp); in TEST()
100 fclose(fp); in TEST()
104 FILE* fp = fopen("/dev/null", "w"); in TEST() local
107 ASSERT_EQ(0, setvbuf(fp, buf, _IOLBF, sizeof(buf))); in TEST()
109 ASSERT_EQ('a', fputc('a', fp)); in TEST()
110 ASSERT_EQ(1U, __fpending(fp)); in TEST()
114 ASSERT_EQ(0U, __fpending(fp)); in TEST()
116 fclose(fp); in TEST()
120 FILE* fp; in TEST() local
123 fp = fopen("/dev/null", "r"); in TEST()
124 ASSERT_TRUE(__freadable(fp)); in TEST()
125 ASSERT_FALSE(__fwritable(fp)); in TEST()
126 fclose(fp); in TEST()
129 fp = fopen("/dev/null", "w"); in TEST()
130 ASSERT_FALSE(__freadable(fp)); in TEST()
131 ASSERT_TRUE(__fwritable(fp)); in TEST()
132 fclose(fp); in TEST()
135 fp = fopen("/dev/null", "a"); in TEST()
136 ASSERT_FALSE(__freadable(fp)); in TEST()
137 ASSERT_TRUE(__fwritable(fp)); in TEST()
138 fclose(fp); in TEST()
142 fp = fopen("/dev/null", read_write_mode); in TEST()
143 ASSERT_TRUE(__freadable(fp)); in TEST()
144 ASSERT_TRUE(__fwritable(fp)); in TEST()
145 fclose(fp); in TEST()
150 FILE* fp; in TEST() local
153 fp = fopen("/dev/zero", "a"); in TEST()
154 ASSERT_FALSE(__freading(fp)); // Not reading initially. in TEST()
155 ASSERT_TRUE(__fwriting(fp)); // Writing initially. in TEST()
156 ASSERT_TRUE(fputc('x', fp) != EOF); in TEST()
157 ASSERT_FALSE(__freading(fp)); // Not reading after write. in TEST()
158 ASSERT_TRUE(__fwriting(fp)); // Still writing after write. in TEST()
159 fclose(fp); in TEST()
162 fp = fopen("/dev/zero", "w"); in TEST()
163 ASSERT_FALSE(__freading(fp)); // Not reading initially. in TEST()
164 ASSERT_TRUE(__fwriting(fp)); // Writing initially. in TEST()
165 ASSERT_TRUE(fputc('x', fp) != EOF); in TEST()
166 ASSERT_FALSE(__freading(fp)); // Not reading after write. in TEST()
167 ASSERT_TRUE(__fwriting(fp)); // Still writing after write. in TEST()
168 fclose(fp); in TEST()
171 fp = fopen("/dev/zero", "r"); in TEST()
172 ASSERT_TRUE(__freading(fp)); // Reading initially. in TEST()
173 ASSERT_FALSE(__fwriting(fp)); // Not writing initially. in TEST()
174 ASSERT_TRUE(fgetc(fp) == 0); in TEST()
175 ASSERT_TRUE(__freading(fp)); // Still reading after read. in TEST()
176 ASSERT_FALSE(__fwriting(fp)); // Still not writing after read. in TEST()
177 fclose(fp); in TEST()
181 fp = fopen("/dev/zero", read_write_mode); in TEST()
182 ASSERT_FALSE(__freading(fp)); // Not reading initially. in TEST()
183 ASSERT_FALSE(__fwriting(fp)); // Not writing initially. in TEST()
184 ASSERT_TRUE(fgetc(fp) == 0); in TEST()
185 ASSERT_TRUE(__freading(fp)); // Reading after read. in TEST()
186 ASSERT_FALSE(__fwriting(fp)); // Not writing after read. in TEST()
187 ASSERT_TRUE(fputc('x', fp) != EOF); in TEST()
188 ASSERT_FALSE(__freading(fp)); // Not reading after write. in TEST()
189 ASSERT_TRUE(__fwriting(fp)); // Writing after write. in TEST()
190 fclose(fp); in TEST()
198 FILE* fp = fopen("/dev/null", "w"); in TEST()
200 ASSERT_FALSE(ferror(fp)); in TEST()
201 __fseterr(fp); in TEST()
202 ASSERT_TRUE(ferror(fp)); in TEST()
203 clearerr(fp); in TEST()
204 ASSERT_FALSE(ferror(fp)); in TEST()
206 fclose(fp); in TEST()
211 FILE* fp = fopen("/proc/version", "r"); in TEST() local
212 ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_QUERY)); in TEST()
213 ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_BYCALLER)); in TEST()
214 ASSERT_EQ(FSETLOCKING_BYCALLER, __fsetlocking(fp, FSETLOCKING_QUERY)); in TEST()
215 ASSERT_EQ(FSETLOCKING_BYCALLER, __fsetlocking(fp, FSETLOCKING_INTERNAL)); in TEST()
216 ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_QUERY)); in TEST()
217 fclose(fp); in TEST()