CodeMod: Prefer ADD_FAILURE() over EXPECT_TRUE(false), et cetera
[folly.git] / folly / test / ConvTest.cpp
index 3d5d0f631b7573cddf1dcc408113537e43042293..77e77d423e25c86ee7d6494ac142fe947e477dfe 100644 (file)
@@ -147,7 +147,7 @@ TEST(Conv, Floating2Floating) {
     EXPECT_TRUE(shouldWork == std::numeric_limits<float>::min() ||
                 shouldWork == 0.f);
   } catch (...) {
-    EXPECT_TRUE(false);
+    ADD_FAILURE();
   }
 }
 
@@ -601,7 +601,7 @@ TEST(Conv, StringPieceToDouble) {
   // Test NaN conversion
   try {
     to<double>("not a number");
-    EXPECT_TRUE(false);
+    ADD_FAILURE();
   } catch (const std::range_error &) {
   }
 
@@ -638,7 +638,7 @@ TEST(Conv, EmptyStringToInt) {
 
   try {
     to<int>(pc);
-    EXPECT_TRUE(false);
+    ADD_FAILURE();
   } catch (const std::range_error &) {
   }
 }
@@ -649,7 +649,7 @@ TEST(Conv, CorruptedStringToInt) {
 
   try {
     to<int64_t>(&pc);
-    EXPECT_TRUE(false);
+    ADD_FAILURE();
   } catch (const std::range_error &) {
   }
 }
@@ -660,7 +660,7 @@ TEST(Conv, EmptyStringToDouble) {
 
   try {
     to<double>(pc);
-    EXPECT_TRUE(false);
+    ADD_FAILURE();
   } catch (const std::range_error &) {
   }
 }
@@ -671,7 +671,7 @@ TEST(Conv, IntToDouble) {
   /* This seems not work in ubuntu11.10, gcc 4.6.1
   try {
     auto f = to<float>(957837589847);
-    EXPECT_TRUE(false);
+    ADD_FAILURE();
   } catch (std::range_error& e) {
     //LOG(INFO) << e.what();
   }
@@ -684,7 +684,7 @@ TEST(Conv, DoubleToInt) {
   try {
     auto i2 = to<int>(42.1);
     LOG(ERROR) << "to<int> returned " << i2 << " instead of throwing";
-    EXPECT_TRUE(false);
+    ADD_FAILURE();
   } catch (std::range_error&) {
     //LOG(INFO) << e.what();
   }
@@ -701,7 +701,7 @@ TEST(Conv, EnumToInt) {
     LOG(ERROR) << "to<char> returned "
                << static_cast<unsigned int>(i2)
                << " instead of throwing";
-    EXPECT_TRUE(false);
+    ADD_FAILURE();
   } catch (std::range_error&) {
     //LOG(INFO) << e.what();
   }
@@ -726,7 +726,7 @@ TEST(Conv, IntToEnum) {
     LOG(ERROR) << "to<A> returned "
                << static_cast<unsigned int>(i2)
                << " instead of throwing";
-    EXPECT_TRUE(false);
+    ADD_FAILURE();
   } catch (std::range_error&) {
     //LOG(INFO) << e.what();
   }
@@ -743,7 +743,7 @@ TEST(Conv, UnsignedEnum) {
   try {
     auto i = to<int32_t>(x);
     LOG(ERROR) << "to<int32_t> returned " << i << " instead of throwing";
-    EXPECT_TRUE(false);
+    ADD_FAILURE();
   } catch (std::range_error&) {
   }
 }
@@ -915,7 +915,7 @@ void testConvError(
   std::string where = to<std::string>(__FILE__, "(", line, "): ");
   try {
     auto res = expr();
-    EXPECT_TRUE(false) << where << exprStr << " -> " << res;
+    ADD_FAILURE() << where << exprStr << " -> " << res;
   } catch (const ConversionError& e) {
     EXPECT_EQ(code, e.errorCode()) << where << exprStr;
     std::string str(e.what());