Commit 56d109e8 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2850] Fix address name generation

parent 9d90db22
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <util/unittests/check_valgrind.h> #include <util/unittests/check_valgrind.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <boost/format.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <boost/interprocess/file_mapping.hpp> #include <boost/interprocess/file_mapping.hpp>
...@@ -33,7 +34,7 @@ using boost::scoped_ptr; ...@@ -33,7 +34,7 @@ using boost::scoped_ptr;
namespace { namespace {
const char* const mapped_file = TEST_DATA_BUILDDIR "/test.mapped"; const char* const mapped_file = TEST_DATA_BUILDDIR "/test.mapped";
const char* const mapped_file2 = TEST_DATA_BUILDDIR "/test2.mapped"; const char* const mapped_file2 = TEST_DATA_BUILDDIR "/test2.mapped";
class ZoneTableSegmentMappedTest : public ::testing::Test { class ZoneTableSegmentMappedTest : public ::testing::Test {
...@@ -86,8 +87,7 @@ createData(MemorySegment& segment) { ...@@ -86,8 +87,7 @@ createData(MemorySegment& segment) {
// to keep the size of test data reasonably small. // to keep the size of test data reasonably small.
UniformRandomIntegerGenerator gen(0, INT_MAX, getpid()); UniformRandomIntegerGenerator gen(0, INT_MAX, getpid());
for (int i = 0; i < 256; ++i) { for (int i = 0; i < 256; ++i) {
string name("name"); const string name(boost::str(boost::format("name%d") % i));
name += i;
const int value = gen(); const int value = gen();
void* ptr = segment.allocate(sizeof(int)); void* ptr = segment.allocate(sizeof(int));
ASSERT_TRUE(ptr); ASSERT_TRUE(ptr);
...@@ -101,8 +101,7 @@ bool ...@@ -101,8 +101,7 @@ bool
verifyData(const MemorySegment& segment) { verifyData(const MemorySegment& segment) {
UniformRandomIntegerGenerator gen(0, INT_MAX, getpid()); UniformRandomIntegerGenerator gen(0, INT_MAX, getpid());
for (int i = 0; i < 256; ++i) { for (int i = 0; i < 256; ++i) {
string name("name"); const string name(boost::str(boost::format("name%d") % i));
name += i;
const int value = gen(); const int value = gen();
const MemorySegment::NamedAddressResult result = const MemorySegment::NamedAddressResult result =
segment.getNamedAddress(name.c_str()); segment.getNamedAddress(name.c_str());
......
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