Skip to content

Commit

Permalink
cleanup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ban-nobuhiro committed Sep 4, 2024
1 parent 1e41608 commit d63da2d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions test/limestone/api/log_and_recover_off_by_one_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ TEST_F(log_and_recover_off_by_one_test, log_and_recovery) {

cursor->key(buf);
auto it1 = expectation.find(buf);
ASSERT_FALSE(it1 == expectation.end());
ASSERT_NE(it1, expectation.end());
cursor->value(buf);
ASSERT_EQ(buf, it1->second);
ASSERT_EQ(cursor->storage(), st);
Expand All @@ -110,7 +110,7 @@ TEST_F(log_and_recover_off_by_one_test, log_and_recovery) {

cursor->key(buf);
auto it2 = expectation.find(buf);
ASSERT_FALSE(it2 == expectation.end());
ASSERT_NE(it2, expectation.end());
cursor->value(buf);
ASSERT_EQ(buf, it2->second);
ASSERT_EQ(cursor->storage(), st);
Expand Down
2 changes: 1 addition & 1 deletion test/limestone/api/multiple_recover_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ TEST_F(multiple_recover_test, two_recovery) {
std::string buf{};
cursor->key(buf);
auto it = expectation.find(buf);
ASSERT_FALSE(it == expectation.end());
ASSERT_NE(it, expectation.end());
cursor->value(buf);
ASSERT_EQ(buf, it->second.second);
ASSERT_EQ(cursor->storage(), it->second.first);
Expand Down
5 changes: 3 additions & 2 deletions test/limestone/log/log_entry_4_LevelDB_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2023 Project Tsurugi.
* Copyright 2022-2024 Project Tsurugi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <unistd.h>
#include "test_root.h"

Expand Down Expand Up @@ -92,7 +93,7 @@ TEST_F(log_entry_4_LevelDB_test, write_and_read_and_write_and_read) {

limestone::api::write_version_type buf_version;
log_entry_normal_.write_version(buf_version);
EXPECT_TRUE(buf_version == write_version);
EXPECT_EQ(buf_version, write_version);
}

} // namespace limestone::testing
7 changes: 4 additions & 3 deletions test/limestone/log/log_entry_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2023 Project Tsurugi.
* Copyright 2022-2024 Project Tsurugi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <unistd.h>
#include "test_root.h"

Expand Down Expand Up @@ -78,7 +79,7 @@ TEST_F(log_entry_test, write_and_read) {

limestone::api::write_version_type buf_version;
log_entry_.write_version(buf_version);
EXPECT_TRUE(buf_version == write_version);
EXPECT_EQ(buf_version, write_version);
}

TEST_F(log_entry_test, write_and_read_and_write_and_read) {
Expand Down Expand Up @@ -113,7 +114,7 @@ TEST_F(log_entry_test, write_and_read_and_write_and_read) {

limestone::api::write_version_type buf_version;
log_entry_.write_version(buf_version);
EXPECT_TRUE(buf_version == write_version);
EXPECT_EQ(buf_version, write_version);
}

} // namespace limestone::testing
7 changes: 4 additions & 3 deletions test/limestone/log/log_entry_type_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2023 Project Tsurugi.
* Copyright 2022-2024 Project Tsurugi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <unistd.h>
#include "test_root.h"

Expand Down Expand Up @@ -90,7 +91,7 @@ TEST_F(log_entry_type_test, write_and_read) {

limestone::api::write_version_type buf_version;
log_entry_normal_.write_version(buf_version);
EXPECT_TRUE(buf_version == write_version);
EXPECT_EQ(buf_version, write_version);

EXPECT_EQ(log_entry_end_.type(), limestone::api::log_entry::entry_type::marker_end);
EXPECT_EQ(log_entry_end_.epoch_id(), epoch_id + 1);
Expand Down Expand Up @@ -139,7 +140,7 @@ TEST_F(log_entry_type_test, write_and_read_and_write_and_read) {

limestone::api::write_version_type buf_version;
log_entry_normal_.write_version(buf_version);
EXPECT_TRUE(buf_version == write_version);
EXPECT_EQ(buf_version, write_version);

EXPECT_EQ(log_entry_end_.type(), limestone::api::log_entry::entry_type::marker_end);
EXPECT_EQ(log_entry_end_.epoch_id(), epoch_id + 1);
Expand Down
2 changes: 1 addition & 1 deletion test/limestone/log/testdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void create_file(const boost::filesystem::path& path, std::string_view content)
strm.open(path, std::ios_base::out | std::ios_base::app | std::ios_base::binary);
strm.write(content.data(), content.size());
strm.flush();
ASSERT_FALSE(!strm || !strm.is_open() || strm.bad() || strm.fail());
LOG_IF(FATAL, !strm || !strm.is_open() || strm.bad() || strm.fail());
strm.close();
}

Expand Down

0 comments on commit d63da2d

Please sign in to comment.