| 74 | }; |
| 75 | |
| 76 | TEST_F(DefaultEnvTest, IncompleteReadOutOfRange) { |
| 77 | const string filename = io::JoinPath(BaseDir(), "out_of_range"); |
| 78 | const string input = CreateTestFile(env_, filename, 2); |
| 79 | std::unique_ptr<RandomAccessFile> f; |
| 80 | TF_EXPECT_OK(env_->NewRandomAccessFile(filename, &f)); |
| 81 | |
| 82 | // Reading past EOF should give an OUT_OF_RANGE error |
| 83 | StringPiece result; |
| 84 | char scratch[3]; |
| 85 | EXPECT_EQ(error::OUT_OF_RANGE, f->Read(0, 3, &result, scratch).code()); |
| 86 | EXPECT_EQ(input, result); |
| 87 | |
| 88 | // Exact read to EOF works. |
| 89 | TF_EXPECT_OK(f->Read(0, 2, &result, scratch)); |
| 90 | EXPECT_EQ(input, result); |
| 91 | } |
| 92 | |
| 93 | TEST_F(DefaultEnvTest, ReadFileToString) { |
| 94 | for (const int length : {0, 1, 1212, 2553, 4928, 8196, 9000, (1 << 20) - 1, |
nothing calls this directly
no test coverage detected