Fixed missing std namespaces and make_unique.

cout/endl were missing the std namespace. Also std::make_unique
was used inadvertently which is part of C++14 and only C++11
is currently supported.

PiperOrigin-RevId: 243221310
This commit is contained in:
Chris Mumford 2019-04-12 01:09:39 -07:00
parent 08e771901f
commit 5a2a472741

View File

@ -66,7 +66,7 @@ TEST(Issue320, Test) {
ReadOptions readOptions; ReadOptions readOptions;
while (count < 200000) { while (count < 200000) {
if ((++count % 1000) == 0) { if ((++count % 1000) == 0) {
cout << "count: " << count << endl; std::cout << "count: " << count << std::endl;
} }
int index = GenerateRandomNumber(test_map.size()); int index = GenerateRandomNumber(test_map.size());
@ -74,18 +74,20 @@ TEST(Issue320, Test) {
if (test_map[index] == nullptr) { if (test_map[index] == nullptr) {
num_items++; num_items++;
test_map[index] = std::make_unique<std::pair<std::string, std::string>>( test_map[index].reset(new std::pair<std::string, std::string>(
CreateRandomString(index), CreateRandomString(index)); CreateRandomString(index), CreateRandomString(index)));
batch.Put(test_map[index]->first, test_map[index]->second); batch.Put(test_map[index]->first, test_map[index]->second);
} else { } else {
ASSERT_OK(db->Get(readOptions, test_map[index]->first, &old_value)); ASSERT_OK(db->Get(readOptions, test_map[index]->first, &old_value));
if (old_value != test_map[index]->second) { if (old_value != test_map[index]->second) {
cout << "ERROR incorrect value returned by Get" << endl; std::cout << "ERROR incorrect value returned by Get" << std::endl;
cout << " count=" << count << endl; std::cout << " count=" << count << std::endl;
cout << " old value=" << old_value << endl; std::cout << " old value=" << old_value << std::endl;
cout << " test_map[index]->second=" << test_map[index]->second << endl; std::cout << " test_map[index]->second=" << test_map[index]->second
cout << " test_map[index]->first=" << test_map[index]->first << endl; << std::endl;
cout << " index=" << index << endl; std::cout << " test_map[index]->first=" << test_map[index]->first
<< std::endl;
std::cout << " index=" << index << std::endl;
ASSERT_EQ(old_value, test_map[index]->second); ASSERT_EQ(old_value, test_map[index]->second);
} }