src/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc
TEST_F(IoTest, FileIo) {
  std::string filename = TestTempDir() + "/zero_copy_stream_test_file";

  for (int i = 0; i < kBlockSizeCount; i++) {
    for (int j = 0; j < kBlockSizeCount; j++) {
      // Make a temporary file.
      int file =
          open(filename.c_str(), O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0777);
      ASSERT_GE(file, 0);

      {
        FileOutputStream output(file, kBlockSizes[i]);
        WriteStuff(&output);
        EXPECT_EQ(0, output.GetErrno());
      }

      // Rewind.
      ASSERT_NE(lseek(file, 0, SEEK_SET), (off_t)-1);

      {
        FileInputStream input(file, kBlockSizes[j]);
        ReadStuff(&input);
        EXPECT_EQ(0, input.GetErrno());
      }

      close(file);
    }
  }
}
// To test files, we create a temporary file, write, read, truncate, repeat.
To test files, we create a temporary file, write, read, truncate, repeat.
To test files we create a temporary file write read truncate repeat .
TEST_F(IoTest, FileIo) {
  std::string filename = TestTempDir() + "/zero_copy_stream_test_file";
  for (int i = 0; i < kBlockSizeCount; i++) {
    for (int j = 0; j < kBlockSizeCount; j++) {
      int file =
          open(filename.c_str(), O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0777);
      ASSERT_GE(file, 0);
      {
        FileOutputStream output(file, kBlockSizes[i]);
        WriteStuff(&output);
        EXPECT_EQ(0, output.GetErrno());
      }
      ASSERT_NE(lseek(file, 0, SEEK_SET), (off_t)-1);
      {
        FileInputStream input(file, kBlockSizes[j]);
        ReadStuff(&input);
        EXPECT_EQ(0, input.GetErrno());
      }
      close(file);
    }
  }
}
TEST_F ( IoTest , FileIo ) { std :: string filename = TestTempDir ( ) + " " ; for ( int i = 0 ; i < kBlockSizeCount ; i ++ ) { for ( int j = 0 ; j < kBlockSizeCount ; j ++ ) { int file = open ( filename . c_str ( ) , O_RDWR | O_CREAT | O_TRUNC | O_BINARY , 0777 ) ; ASSERT_GE ( file , 0 ) ; { FileOutputStream output ( file , kBlockSizes [ i ] ) ; WriteStuff ( & output ) ; EXPECT_EQ ( 0 , output . GetErrno ( ) ) ; } ASSERT_NE ( lseek ( file , 0 , SEEK_SET ) , ( off_t ) - 1 ) ; { FileInputStream input ( file , kBlockSizes [ j ] ) ; ReadStuff ( & input ) ; EXPECT_EQ ( 0 , input . GetErrno ( ) ) ; } close ( file ) ; } } }
To test files, we create a temporary file, write, read, truncate, repeat.
To test files we create a temporary file write read truncate repeat .
// Make a temporary file. // Rewind.