Skip to content

Commit

Permalink
cleanup: chrono literals (#14826)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolduc authored Nov 6, 2024
1 parent aa062cf commit 4174d65
Show file tree
Hide file tree
Showing 28 changed files with 41 additions and 42 deletions.
11 changes: 5 additions & 6 deletions google/cloud/bigtable/column_family_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ namespace bigtable {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

// NOLINTNEXTLINE
using ::google::cloud::testing_util::chrono_literals::operator"" _min;
using ::google::cloud::testing_util::chrono_literals::operator"" _h; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator"" _s; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator"" _us; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator"" _ns; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_min;
using ::google::cloud::testing_util::chrono_literals::operator""_h;
using ::google::cloud::testing_util::chrono_literals::operator""_s;
using ::google::cloud::testing_util::chrono_literals::operator""_us;
using ::google::cloud::testing_util::chrono_literals::operator""_ns;

TEST(GcRule, Equality) {
auto gc1 = GcRule::MaxNumVersions(3);
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/bigtable/filters_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ namespace {
namespace btproto = ::google::bigtable::v2;

using ::google::cloud::testing_util::IsProtoEqual;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator"" _us; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::google::cloud::testing_util::chrono_literals::operator""_us;

TEST(FiltersTest, Equality) {
auto f1 = Filter::PassAllFilter();
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/bigtable/idempotent_mutation_policy_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace bigtable {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator"" _us; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::google::cloud::testing_util::chrono_literals::operator""_us;

/// @test Verify that the default policy works as expected.
TEST(IdempotentMutationPolicyTest, Simple) {
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/internal/bulk_mutator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

namespace v2 = ::google::bigtable::v2;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::google::cloud::bigtable::testing::MockBigtableStub;
using ::google::cloud::bigtable::testing::MockMutateRowsLimiter;
using ::google::cloud::bigtable::testing::MockMutateRowsStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace btproto = ::google::bigtable::v2;

using ::google::cloud::bigtable::testing::MockBackoffPolicy;
using ::google::cloud::bigtable::testing::MockClientAsyncReaderInterface;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::google::cloud::testing_util::FakeCompletionQueueImpl;
using ::google::cloud::testing_util::StatusIs;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace btproto = ::google::bigtable::v2;

using ::google::cloud::bigtable::testing::MockClientAsyncReaderInterface;
using ::google::cloud::testing_util::ValidateMetadataFixture;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::google::cloud::testing_util::FakeCompletionQueueImpl;
using ::testing::HasSubstr;
using ::testing::Values;
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/internal/legacy_bulk_mutator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace {

namespace btproto = ::google::bigtable::v2;
using ::testing::Return;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::google::cloud::bigtable::testing::MockMutateRowsReader;

auto constexpr kTableName = "projects/blah/instances/blah2/tables/table";
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/mutation_batcher_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ using ::google::cloud::bigtable_mocks::MockDataConnection;
using ::google::cloud::testing_util::IsOk;
using ::google::cloud::testing_util::IsProtoEqual;
using ::google::cloud::testing_util::MockCompletionQueueImpl;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::testing::Not;
using ::testing::Return;
using ::testing::WithParamInterface;
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/bigtable/mutations_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ namespace {

namespace btproto = ::google::bigtable::v2;

using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator"" _us; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::google::cloud::testing_util::chrono_literals::operator""_us;

TEST(SingleRowMutation, Equality) {
auto m1 = SingleRowMutation("m1", DeleteFromRow());
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/polling_policy_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ grpc::Status GrpcTransientError() {
return grpc::Status(grpc::StatusCode::UNAVAILABLE, "try again");
}

using testing_util::chrono_literals::operator"" _ms; // NOLINT
using testing_util::chrono_literals::operator""_ms;
auto const kLimitedTimeTestPeriod = 100_ms;
auto const kLimitedTimeTolerance = 20_ms;

Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/rpc_backoff_policy_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace bigtable {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;

/// Create a grpc::Status with a status code for transient errors.
grpc::Status GrpcTransientError() {
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/rpc_retry_policy_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Status PermanentError() {
return Status(StatusCode::kFailedPrecondition, "failed");
}

using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;

auto const kLimitedTimeTestPeriod = 100_ms;
auto const kLimitedTimeTolerance = 20_ms;
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/table_apply_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace {
namespace bigtable = ::google::cloud::bigtable;
using ::google::cloud::testing_util::StatusIs;
using ::google::cloud::testing_util::ValidateMetadataFixture;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;

class TableApplyTest : public bigtable::testing::TableTestFixture {
protected:
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/bigtable/table_bulk_apply_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace btproto = ::google::bigtable::v2;

using ::google::cloud::bigtable::testing::MockBackoffPolicy;
using ::google::cloud::testing_util::IsOk;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator"" _us; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::google::cloud::testing_util::chrono_literals::operator""_us;
using ::testing::An;
using ::testing::Not;
using ::testing::Return;
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/table_check_and_mutate_row_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

using ::google::cloud::testing_util::ValidateMetadataFixture;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;

class TableCheckAndMutateRowTest : public bigtable::testing::TableTestFixture {
protected:
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/table_sample_row_keys_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace bigtable {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

using ::google::cloud::testing_util::chrono_literals::operator"" _us; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_us;
using ::google::cloud::bigtable::testing::MockSampleRowKeysReader;
using ::testing::Return;
using ::testing::Unused;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

using ::google::cloud::bigtable::testing::TableIntegrationTest;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;

class DataAsyncIntegrationTest
: public TableIntegrationTest,
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/tests/data_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace {

using ::google::cloud::bigtable::testing::TableIntegrationTest;
using ::google::cloud::bigtable::testing::TableTestEnvironment;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::std::chrono::duration_cast;
using ::std::chrono::microseconds;
using ::std::chrono::milliseconds;
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/tests/filters_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace bigtable {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::testing::ContainerEq;

using FilterIntegrationTest =
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/tests/mutations_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

using ::google::cloud::testing_util::IsOk;
using ::google::cloud::testing_util::chrono_literals::operator"" _us; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_us;
using ::testing::Not;

using MutationIntegrationTest =
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/future_generic_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace cloud {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {
using ::testing::HasSubstr;
using testing_util::chrono_literals::operator"" _ms; // NOLINT
using testing_util::chrono_literals::operator""_ms;
using testing_util::ExpectFutureError;
using testing_util::ScopedThread;

Expand Down
2 changes: 1 addition & 1 deletion google/cloud/future_generic_then_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace cloud {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {
using ::testing::HasSubstr;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::google::cloud::testing_util::ExpectFutureError;

TEST(FutureTestInt, ThenSimple) {
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/future_void_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace cloud {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {
using ::testing::HasSubstr;
using testing_util::chrono_literals::operator"" _ms; // NOLINT
using testing_util::chrono_literals::operator""_ms;
using testing_util::ExpectFutureError;
using testing_util::ScopedThread;

Expand Down
2 changes: 1 addition & 1 deletion google/cloud/future_void_then_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace cloud {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {
using ::testing::HasSubstr;
using testing_util::chrono_literals::operator"" _ms; // NOLINT
using testing_util::chrono_literals::operator""_ms;
using testing_util::ExpectFutureError;

TEST(FutureTestVoid, ThenSimple) {
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/internal/future_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace internal {
namespace {

using ::testing::HasSubstr;
using testing_util::chrono_literals::operator"" _us; // NOLINT
using testing_util::chrono_literals::operator""_us;
using testing_util::ExpectFutureError;

TEST(FutureImplInt, Basic) {
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/storage/parallel_uploads_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace internal {
namespace {

using ::google::cloud::storage::testing::canonical_errors::PermanentError;
using ::google::cloud::testing_util::chrono_literals::operator"" _ms; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
using ::google::cloud::testing_util::IsOk;
using ::google::cloud::testing_util::StatusIs;
using ::testing::ElementsAre;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace storage {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

using ::google::cloud::testing_util::chrono_literals::operator"" _us; // NOLINT
using ::google::cloud::testing_util::chrono_literals::operator""_us;
using ::google::cloud::testing_util::IsOk;
using ::google::cloud::testing_util::StatusIs;
using ::testing::HasSubstr;
Expand Down
12 changes: 6 additions & 6 deletions google/cloud/testing_util/chrono_literals.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,32 @@ namespace testing_util {
namespace chrono_literals {

// NOLINTNEXTLINE(google-runtime-int)
std::chrono::hours constexpr operator"" _h(unsigned long long h) {
std::chrono::hours constexpr operator""_h(unsigned long long h) {
return std::chrono::hours(h);
}

// NOLINTNEXTLINE(google-runtime-int)
std::chrono::minutes constexpr operator"" _min(unsigned long long m) {
std::chrono::minutes constexpr operator""_min(unsigned long long m) {
return std::chrono::minutes(m);
}

// NOLINTNEXTLINE(google-runtime-int)
std::chrono::seconds constexpr operator"" _s(unsigned long long s) {
std::chrono::seconds constexpr operator""_s(unsigned long long s) {
return std::chrono::seconds(s);
}

// NOLINTNEXTLINE(google-runtime-int)
std::chrono::milliseconds constexpr operator"" _ms(unsigned long long ms) {
std::chrono::milliseconds constexpr operator""_ms(unsigned long long ms) {
return std::chrono::milliseconds(ms);
}

// NOLINTNEXTLINE(google-runtime-int)
std::chrono::microseconds constexpr operator"" _us(unsigned long long us) {
std::chrono::microseconds constexpr operator""_us(unsigned long long us) {
return std::chrono::microseconds(us);
}

// NOLINTNEXTLINE(google-runtime-int)
std::chrono::nanoseconds constexpr operator"" _ns(unsigned long long ns) {
std::chrono::nanoseconds constexpr operator""_ns(unsigned long long ns) {
return std::chrono::nanoseconds(ns);
}

Expand Down

0 comments on commit 4174d65

Please sign in to comment.