aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/test/clang-tidy/checkers/abseil/duration-comparison.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/checkers/abseil/duration-comparison.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/abseil/duration-comparison.cpp68
1 files changed, 34 insertions, 34 deletions
diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil/duration-comparison.cpp b/clang-tools-extra/test/clang-tidy/checkers/abseil/duration-comparison.cpp
index 6110dfd..8f49e71 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/abseil/duration-comparison.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/abseil/duration-comparison.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy --match-partial-fixes %s abseil-duration-comparison %t -- -- -I%S/Inputs
+// RUN: %check_clang_tidy %s abseil-duration-comparison %t -- -- -I%S/Inputs
#include "absl/time/time.h"
@@ -11,104 +11,104 @@ void f() {
// Check against the RHS
b = x > absl::ToDoubleSeconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(x) > d1;
+ // CHECK-FIXES: b = absl::Seconds(x) > d1;
b = x >= absl::ToDoubleSeconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(x) >= d1;
+ // CHECK-FIXES: b = absl::Seconds(x) >= d1;
b = x == absl::ToDoubleSeconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(x) == d1;
+ // CHECK-FIXES: b = absl::Seconds(x) == d1;
b = x <= absl::ToDoubleSeconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(x) <= d1;
+ // CHECK-FIXES: b = absl::Seconds(x) <= d1;
b = x < absl::ToDoubleSeconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(x) < d1;
+ // CHECK-FIXES: b = absl::Seconds(x) < d1;
b = x == absl::ToDoubleSeconds(t1 - t2);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(x) == t1 - t2;
+ // CHECK-FIXES: b = absl::Seconds(x) == t1 - t2;
b = absl::ToDoubleSeconds(d1) > absl::ToDoubleSeconds(d2);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: d1 > d2;
+ // CHECK-FIXES: b = d1 > d2;
// Check against the LHS
b = absl::ToDoubleSeconds(d1) < x;
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: d1 < absl::Seconds(x);
+ // CHECK-FIXES: b = d1 < absl::Seconds(x);
b = absl::ToDoubleSeconds(d1) <= x;
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: d1 <= absl::Seconds(x);
+ // CHECK-FIXES: b = d1 <= absl::Seconds(x);
b = absl::ToDoubleSeconds(d1) == x;
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: d1 == absl::Seconds(x);
+ // CHECK-FIXES: b = d1 == absl::Seconds(x);
b = absl::ToDoubleSeconds(d1) >= x;
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: d1 >= absl::Seconds(x);
+ // CHECK-FIXES: b = d1 >= absl::Seconds(x);
b = absl::ToDoubleSeconds(d1) > x;
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: d1 > absl::Seconds(x);
+ // CHECK-FIXES: b = d1 > absl::Seconds(x);
// Comparison against zero
b = absl::ToDoubleSeconds(d1) < 0.0;
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: d1 < absl::ZeroDuration();
+ // CHECK-FIXES: b = d1 < absl::ZeroDuration();
b = absl::ToDoubleSeconds(d1) < 0;
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: d1 < absl::ZeroDuration();
+ // CHECK-FIXES: b = d1 < absl::ZeroDuration();
// Scales other than Seconds
b = x > absl::ToDoubleMicroseconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Microseconds(x) > d1;
+ // CHECK-FIXES: b = absl::Microseconds(x) > d1;
b = x >= absl::ToDoubleMilliseconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Milliseconds(x) >= d1;
+ // CHECK-FIXES: b = absl::Milliseconds(x) >= d1;
b = x == absl::ToDoubleNanoseconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Nanoseconds(x) == d1;
+ // CHECK-FIXES: b = absl::Nanoseconds(x) == d1;
b = x <= absl::ToDoubleMinutes(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Minutes(x) <= d1;
+ // CHECK-FIXES: b = absl::Minutes(x) <= d1;
b = x < absl::ToDoubleHours(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Hours(x) < d1;
+ // CHECK-FIXES: b = absl::Hours(x) < d1;
// Integer comparisons
b = x > absl::ToInt64Microseconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Microseconds(x) > d1;
+ // CHECK-FIXES: b = absl::Microseconds(x) > d1;
b = x >= absl::ToInt64Milliseconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Milliseconds(x) >= d1;
+ // CHECK-FIXES: b = absl::Milliseconds(x) >= d1;
b = x == absl::ToInt64Nanoseconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Nanoseconds(x) == d1;
+ // CHECK-FIXES: b = absl::Nanoseconds(x) == d1;
b = x == absl::ToInt64Seconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(x) == d1;
+ // CHECK-FIXES: b = absl::Seconds(x) == d1;
b = x <= absl::ToInt64Minutes(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Minutes(x) <= d1;
+ // CHECK-FIXES: b = absl::Minutes(x) <= d1;
b = x < absl::ToInt64Hours(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Hours(x) < d1;
+ // CHECK-FIXES: b = absl::Hours(x) < d1;
// Other abseil-duration checks folded into this one
b = static_cast<double>(5) > absl::ToDoubleSeconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(5) > d1;
+ // CHECK-FIXES: b = absl::Seconds(5) > d1;
b = double(5) > absl::ToDoubleSeconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(5) > d1;
+ // CHECK-FIXES: b = absl::Seconds(5) > d1;
b = float(5) > absl::ToDoubleSeconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(5) > d1;
+ // CHECK-FIXES: b = absl::Seconds(5) > d1;
b = ((double)5) > absl::ToDoubleSeconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(5) > d1;
+ // CHECK-FIXES: b = absl::Seconds(5) > d1;
b = 5.0 > absl::ToDoubleSeconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Seconds(5) > d1;
+ // CHECK-FIXES: b = absl::Seconds(5) > d1;
// A long expression
bool some_condition;
@@ -125,20 +125,20 @@ void f() {
int y;
b = (y + 5) * 10 > absl::ToDoubleMilliseconds(d1);
// CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: absl::Milliseconds((y + 5) * 10) > d1;
+ // CHECK-FIXES: b = absl::Milliseconds((y + 5) * 10) > d1;
// We should still transform the expression inside this macro invocation
#define VALUE_IF(v, e) v ? (e) : 0
int a = VALUE_IF(1, 5 > absl::ToDoubleSeconds(d1));
// CHECK-MESSAGES: [[@LINE-1]]:23: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: VALUE_IF(1, absl::Seconds(5) > d1);
+ // CHECK-FIXES: int a = VALUE_IF(1, absl::Seconds(5) > d1);
#undef VALUE_IF
#define VALUE_IF_2(e) (e)
#define VALUE_IF(v, e) v ? VALUE_IF_2(e) : VALUE_IF_2(0)
int a2 = VALUE_IF(1, 5 > absl::ToDoubleSeconds(d1));
// CHECK-MESSAGES: [[@LINE-1]]:24: warning: perform comparison in the duration domain [abseil-duration-comparison]
- // CHECK-FIXES: VALUE_IF(1, absl::Seconds(5) > d1);
+ // CHECK-FIXES: int a2 = VALUE_IF(1, absl::Seconds(5) > d1);
#undef VALUE_IF
#undef VALUE_IF_2