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 /util/env_windows_test.cc | |
parent | 2c9c80bd539ca5aad5ea864ee6dd81c1ee3eb91e (diff) | |
download | leveldb-1c58902bdcc8d129f3883606bbd8e59085b48878.tar.gz |
Switch testing harness to googletest.
PiperOrigin-RevId: 281815695
Diffstat (limited to 'util/env_windows_test.cc')
-rw-r--r-- | util/env_windows_test.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/util/env_windows_test.cc b/util/env_windows_test.cc index 3c22133..b926107 100644 --- a/util/env_windows_test.cc +++ b/util/env_windows_test.cc @@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. +#include "third_party/googletest/googletest/include/gtest/gtest.h" #include "leveldb/env.h" - #include "port/port.h" #include "util/env_windows_test_helper.h" -#include "util/testharness.h" +#include "util/testutil.h" namespace leveldb { static const int kMMapLimit = 4; -class EnvWindowsTest { +class EnvWindowsTest : public testing::Test { public: static void SetFileLimits(int mmap_limit) { EnvWindowsTestHelper::SetReadOnlyMMapLimit(mmap_limit); @@ -23,10 +23,10 @@ class EnvWindowsTest { Env* env_; }; -TEST(EnvWindowsTest, TestOpenOnRead) { +TEST_F(EnvWindowsTest, TestOpenOnRead) { // Write some test data to a single file that will be opened |n| times. std::string test_dir; - ASSERT_OK(env_->GetTestDirectory(&test_dir)); + ASSERT_LEVELDB_OK(env_->GetTestDirectory(&test_dir)); std::string test_file = test_dir + "/open_on_read.txt"; FILE* f = fopen(test_file.c_str(), "w"); @@ -41,18 +41,18 @@ TEST(EnvWindowsTest, TestOpenOnRead) { const int kNumFiles = kMMapLimit + 5; leveldb::RandomAccessFile* files[kNumFiles] = {0}; for (int i = 0; i < kNumFiles; i++) { - ASSERT_OK(env_->NewRandomAccessFile(test_file, &files[i])); + ASSERT_LEVELDB_OK(env_->NewRandomAccessFile(test_file, &files[i])); } char scratch; Slice read_result; for (int i = 0; i < kNumFiles; i++) { - ASSERT_OK(files[i]->Read(i, 1, &read_result, &scratch)); + ASSERT_LEVELDB_OK(files[i]->Read(i, 1, &read_result, &scratch)); ASSERT_EQ(kFileData[i], read_result[0]); } for (int i = 0; i < kNumFiles; i++) { delete files[i]; } - ASSERT_OK(env_->DeleteFile(test_file)); + ASSERT_LEVELDB_OK(env_->DeleteFile(test_file)); } } // namespace leveldb @@ -60,5 +60,6 @@ TEST(EnvWindowsTest, TestOpenOnRead) { int main(int argc, char** argv) { // All tests currently run with the same read-only file limits. leveldb::EnvWindowsTest::SetFileLimits(leveldb::kMMapLimit); - return leveldb::test::RunAllTests(); + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } |