am 1d7b3f3c: Merge "Improve <stdio_ext.h> testing."

* commit '1d7b3f3ccc4f2883cbc0fe677dff888c56c18996':
  Improve <stdio_ext.h> testing.
This commit is contained in:
Elliott Hughes 2015-01-20 18:27:47 +00:00 committed by Android Git Automerger
commit 3873c9dfe6

View File

@ -34,7 +34,13 @@
TEST(stdio_ext, __fbufsize) {
FILE* fp = fopen("/proc/version", "r");
// Initially, there's no buffer in case the first thing you do is disable buffering.
ASSERT_EQ(0U, __fbufsize(fp));
// A read forces a buffer to be created.
char buf[128];
fgets(buf, sizeof(buf), fp);
ASSERT_EQ(1024U, __fbufsize(fp));
ASSERT_EQ(0, setvbuf(fp, buf, _IOFBF, 1));
ASSERT_EQ(1U, __fbufsize(fp));