Commit db8cec0c authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2850] Change style of code to fix buildbot failures

parent bc3d4829
......@@ -43,18 +43,19 @@ checkSegmentNamedAddress(MemorySegment& segment, bool out_of_segment_ok) {
EXPECT_THROW(segment.setNamedAddress(NULL, ptr32), InvalidParameter);
// we can now get it; the stored value should be intact.
EXPECT_EQ(MemorySegment::NamedAddressResult(true, ptr32),
segment.getNamedAddress("test address"));
EXPECT_EQ(test_val, *static_cast<const uint32_t*>(ptr32));
MemorySegment::NamedAddressResult result =
segment.getNamedAddress("test address");
EXPECT_TRUE(result.first);
EXPECT_EQ(test_val, *static_cast<const uint32_t*>(result.second));
// Override it.
void* ptr16 = segment.allocate(sizeof(uint16_t));
const uint16_t test_val16 = 4200;
*static_cast<uint16_t*>(ptr16) = test_val16;
EXPECT_FALSE(segment.setNamedAddress("test address", ptr16));
EXPECT_EQ(MemorySegment::NamedAddressResult(true, ptr16),
segment.getNamedAddress("test address"));
EXPECT_EQ(test_val16, *static_cast<const uint16_t*>(ptr16));
result = segment.getNamedAddress("test address");
EXPECT_TRUE(result.first);
EXPECT_EQ(test_val16, *static_cast<const uint16_t*>(result.second));
// Clear it. Then we won't be able to find it any more.
EXPECT_TRUE(segment.clearNamedAddress("test address"));
......@@ -65,8 +66,9 @@ checkSegmentNamedAddress(MemorySegment& segment, bool out_of_segment_ok) {
// Setting NULL is okay.
EXPECT_FALSE(segment.setNamedAddress("null address", NULL));
EXPECT_EQ(MemorySegment::NamedAddressResult(true, NULL),
segment.getNamedAddress("null address"));
result = segment.getNamedAddress("null address");
EXPECT_TRUE(result.first);
EXPECT_FALSE(result.second);
// If the underlying implementation performs explicit check against
// out-of-segment address, confirm the behavior.
......
......@@ -311,7 +311,7 @@ TEST_F(MemorySegmentMappedTest, namedAddress) {
segment_.reset(); // close it before opening another one
segment_.reset(new MemorySegmentMapped(mapped_file));
const MemorySegment::NamedAddressResult result =
MemorySegment::NamedAddressResult result =
segment_->getNamedAddress("test address");
ASSERT_TRUE(result.first);
EXPECT_EQ(test_val16, *static_cast<const uint16_t*>(result.second));
......@@ -325,8 +325,9 @@ TEST_F(MemorySegmentMappedTest, namedAddress) {
const std::string long_name(1025, 'x'); // definitely larger than segment
// setNamedAddress should return true, indicating segment has grown.
EXPECT_TRUE(segment_->setNamedAddress(long_name.c_str(), NULL));
EXPECT_EQ(MemorySegment::NamedAddressResult(true, NULL),
segment_->getNamedAddress(long_name.c_str()));
result = segment_->getNamedAddress(long_name.c_str());
EXPECT_TRUE(result.first);
EXPECT_FALSE(result.second);
// Check contents pointed by named addresses survive growing and
// shrinking segment.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment