| 251 | }; |
| 252 | |
| 253 | void AssertGetObject(Aws::S3::Model::GetObjectResult& result, |
| 254 | const std::string& expected) { |
| 255 | auto length = static_cast<int64_t>(expected.length()); |
| 256 | ASSERT_EQ(result.GetContentLength(), length); |
| 257 | auto& stream = result.GetBody(); |
| 258 | std::string actual; |
| 259 | actual.resize(length + 1); |
| 260 | stream.read(&actual[0], length + 1); |
| 261 | ASSERT_EQ(stream.gcount(), length); // EOF was reached before length + 1 |
| 262 | actual.resize(length); |
| 263 | ASSERT_EQ(actual.size(), expected.size()); |
| 264 | ASSERT_TRUE(actual == expected); // Avoid ASSERT_EQ on large data |
| 265 | } |
| 266 | |
| 267 | void AssertObjectContents(Aws::S3::S3Client* client, const std::string& bucket, |
| 268 | const std::string& key, const std::string& expected) { |
no test coverage detected