Skip to content

Commit

Permalink
Fixed missing std namespaces and make_unique.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cmumford committed Apr 12, 2019
1 parent 08e7719 commit 5a2a472
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions issues/issue320_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,28 @@ TEST(Issue320, Test) {
ReadOptions readOptions;
while (count < 200000) {
if ((++count % 1000) == 0) {
cout << "count: " << count << endl;
std::cout << "count: " << count << std::endl;
}

int index = GenerateRandomNumber(test_map.size());
WriteBatch batch;

if (test_map[index] == nullptr) {
num_items++;
test_map[index] = std::make_unique<std::pair<std::string, std::string>>(
CreateRandomString(index), CreateRandomString(index));
test_map[index].reset(new std::pair<std::string, std::string>(
CreateRandomString(index), CreateRandomString(index)));
batch.Put(test_map[index]->first, test_map[index]->second);
} else {
ASSERT_OK(db->Get(readOptions, test_map[index]->first, &old_value));
if (old_value != test_map[index]->second) {
cout << "ERROR incorrect value returned by Get" << endl;
cout << " count=" << count << endl;
cout << " old value=" << old_value << endl;
cout << " test_map[index]->second=" << test_map[index]->second << endl;
cout << " test_map[index]->first=" << test_map[index]->first << endl;
cout << " index=" << index << endl;
std::cout << "ERROR incorrect value returned by Get" << std::endl;
std::cout << " count=" << count << std::endl;
std::cout << " old value=" << old_value << std::endl;
std::cout << " test_map[index]->second=" << test_map[index]->second
<< std::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);
}

Expand Down

0 comments on commit 5a2a472

Please sign in to comment.