diff options
author | Victor Costan <costan@google.com> | 2019-11-21 13:09:53 -0800 |
---|---|---|
committer | Victor Costan <pwnall@chromium.org> | 2019-11-21 13:11:40 -0800 |
commit | 1c58902bdcc8d129f3883606bbd8e59085b48878 (patch) | |
tree | 8ca631cdc3575fa2f33be0dc28b9d94d610202a1 /issues/issue320_test.cc | |
parent | 2c9c80bd539ca5aad5ea864ee6dd81c1ee3eb91e (diff) | |
download | leveldb-1c58902bdcc8d129f3883606bbd8e59085b48878.tar.gz |
Switch testing harness to googletest.
PiperOrigin-RevId: 281815695
Diffstat (limited to 'issues/issue320_test.cc')
-rw-r--r-- | issues/issue320_test.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/issues/issue320_test.cc b/issues/issue320_test.cc index c5fcbfc..c289ab4 100644 --- a/issues/issue320_test.cc +++ b/issues/issue320_test.cc @@ -9,9 +9,10 @@ #include <string> #include <vector> +#include "third_party/googletest/googletest/include/gtest/gtest.h" #include "leveldb/db.h" #include "leveldb/write_batch.h" -#include "util/testharness.h" +#include "util/testutil.h" namespace leveldb { @@ -37,8 +38,6 @@ std::string CreateRandomString(int32_t index) { } // namespace -class Issue320 {}; - TEST(Issue320, Test) { std::srand(0); @@ -53,8 +52,8 @@ TEST(Issue320, Test) { Options options; options.create_if_missing = true; - std::string dbpath = test::TmpDir() + "/leveldb_issue320_test"; - ASSERT_OK(DB::Open(options, dbpath, &db)); + std::string dbpath = testing::TempDir() + "leveldb_issue320_test"; + ASSERT_LEVELDB_OK(DB::Open(options, dbpath, &db)); uint32_t target_size = 10000; uint32_t num_items = 0; @@ -78,7 +77,8 @@ TEST(Issue320, Test) { 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)); + ASSERT_LEVELDB_OK( + db->Get(readOptions, test_map[index]->first, &old_value)); if (old_value != test_map[index]->second) { std::cout << "ERROR incorrect value returned by Get" << std::endl; std::cout << " count=" << count << std::endl; @@ -102,7 +102,7 @@ TEST(Issue320, Test) { } } - ASSERT_OK(db->Write(writeOptions, &batch)); + ASSERT_LEVELDB_OK(db->Write(writeOptions, &batch)); if (keep_snapshots && GenerateRandomNumber(10) == 0) { int i = GenerateRandomNumber(snapshots.size()); @@ -125,4 +125,7 @@ TEST(Issue320, Test) { } // namespace leveldb -int main(int argc, char** argv) { return leveldb::test::RunAllTests(); } +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} |