Skip to content

Commit

Permalink
PR #1786: Fix typo in test case.
Browse files Browse the repository at this point in the history
Imported from GitHub PR #1786

Merge d81cf21 into dee1b6c

Merging this change closes #1786

COPYBARA_INTEGRATE_REVIEW=#1786 from c8ef:master d81cf21
PiperOrigin-RevId: 694627073
Change-Id: I7ba1dcc5aacdc1c8209628cff0a4e29a62cde7e6
  • Loading branch information
c8ef authored and copybara-github committed Nov 8, 2024
1 parent 6312b70 commit 8924509
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions absl/base/optimization_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ TEST(PredictTest, Optional) {
EXPECT_FALSE(ABSL_PREDICT_FALSE(no_value));
}

class ImplictlyConvertibleToBool {
class ImplicitlyConvertibleToBool {
public:
explicit ImplictlyConvertibleToBool(bool value) : value_(value) {}
explicit ImplicitlyConvertibleToBool(bool value) : value_(value) {}
operator bool() const { // NOLINT(google-explicit-constructor)
return value_;
}
Expand All @@ -100,26 +100,26 @@ class ImplictlyConvertibleToBool {
};

TEST(PredictTest, ImplicitBoolConversion) {
const ImplictlyConvertibleToBool is_true(true);
const ImplictlyConvertibleToBool is_false(false);
const ImplicitlyConvertibleToBool is_true(true);
const ImplicitlyConvertibleToBool is_false(false);
if (!ABSL_PREDICT_TRUE(is_true)) ADD_FAILURE();
if (ABSL_PREDICT_TRUE(is_false)) ADD_FAILURE();
if (!ABSL_PREDICT_FALSE(is_true)) ADD_FAILURE();
if (ABSL_PREDICT_FALSE(is_false)) ADD_FAILURE();
}

class ExplictlyConvertibleToBool {
class ExplicitlyConvertibleToBool {
public:
explicit ExplictlyConvertibleToBool(bool value) : value_(value) {}
explicit ExplicitlyConvertibleToBool(bool value) : value_(value) {}
explicit operator bool() const { return value_; }

private:
bool value_;
};

TEST(PredictTest, ExplicitBoolConversion) {
const ExplictlyConvertibleToBool is_true(true);
const ExplictlyConvertibleToBool is_false(false);
const ExplicitlyConvertibleToBool is_true(true);
const ExplicitlyConvertibleToBool is_false(false);
if (!ABSL_PREDICT_TRUE(is_true)) ADD_FAILURE();
if (ABSL_PREDICT_TRUE(is_false)) ADD_FAILURE();
if (!ABSL_PREDICT_FALSE(is_true)) ADD_FAILURE();
Expand Down

0 comments on commit 8924509

Please sign in to comment.