parent
							
								
									94b4464c9e
								
							
						
					
					
						commit
						0346c06158
					
				@ -27,11 +27,10 @@
 | 
			
		||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
			
		||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
// This file is AUTOMATICALLY GENERATED on 01/02/2018 by command
 | 
			
		||||
// This file is AUTOMATICALLY GENERATED on 01/02/2019 by command
 | 
			
		||||
// 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
 | 
			
		||||
//
 | 
			
		||||
// Implements a family of generic predicate assertion macros.
 | 
			
		||||
 | 
			
		||||
// GOOGLETEST_CM0001 DO NOT DELETE
 | 
			
		||||
 | 
			
		||||
#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
 | 
			
		||||
@ -67,6 +66,8 @@ namespace testing {
 | 
			
		||||
// We also define the EXPECT_* variations.
 | 
			
		||||
//
 | 
			
		||||
// For now we only support predicates whose arity is at most 5.
 | 
			
		||||
// Please email googletestframework@googlegroups.com if you need
 | 
			
		||||
// support for higher arities.
 | 
			
		||||
 | 
			
		||||
// GTEST_ASSERT_ is the basic statement to which all of the assertions
 | 
			
		||||
// in this file reduce.  Don't use this in your code.
 | 
			
		||||
@ -89,9 +90,10 @@ AssertionResult AssertPred1Helper(const char* pred_text,
 | 
			
		||||
                                  const T1& v1) {
 | 
			
		||||
  if (pred(v1)) return AssertionSuccess();
 | 
			
		||||
 | 
			
		||||
  return AssertionFailure() << pred_text << "("
 | 
			
		||||
                            << e1 << ") evaluates to false, where"
 | 
			
		||||
                            << "\n" << e1 << " evaluates to " << v1;
 | 
			
		||||
  return AssertionFailure()
 | 
			
		||||
         << pred_text << "(" << e1 << ") evaluates to false, where"
 | 
			
		||||
         << "\n"
 | 
			
		||||
         << e1 << " evaluates to " << ::testing::PrintToString(v1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
 | 
			
		||||
@ -133,11 +135,12 @@ AssertionResult AssertPred2Helper(const char* pred_text,
 | 
			
		||||
                                  const T2& v2) {
 | 
			
		||||
  if (pred(v1, v2)) return AssertionSuccess();
 | 
			
		||||
 | 
			
		||||
  return AssertionFailure() << pred_text << "("
 | 
			
		||||
                            << e1 << ", "
 | 
			
		||||
                            << e2 << ") evaluates to false, where"
 | 
			
		||||
                            << "\n" << e1 << " evaluates to " << v1
 | 
			
		||||
                            << "\n" << e2 << " evaluates to " << v2;
 | 
			
		||||
  return AssertionFailure()
 | 
			
		||||
         << pred_text << "(" << e1 << ", " << e2
 | 
			
		||||
         << ") evaluates to false, where"
 | 
			
		||||
         << "\n"
 | 
			
		||||
         << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
 | 
			
		||||
         << e2 << " evaluates to " << ::testing::PrintToString(v2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
 | 
			
		||||
@ -184,13 +187,13 @@ AssertionResult AssertPred3Helper(const char* pred_text,
 | 
			
		||||
                                  const T3& v3) {
 | 
			
		||||
  if (pred(v1, v2, v3)) return AssertionSuccess();
 | 
			
		||||
 | 
			
		||||
  return AssertionFailure() << pred_text << "("
 | 
			
		||||
                            << e1 << ", "
 | 
			
		||||
                            << e2 << ", "
 | 
			
		||||
                            << e3 << ") evaluates to false, where"
 | 
			
		||||
                            << "\n" << e1 << " evaluates to " << v1
 | 
			
		||||
                            << "\n" << e2 << " evaluates to " << v2
 | 
			
		||||
                            << "\n" << e3 << " evaluates to " << v3;
 | 
			
		||||
  return AssertionFailure()
 | 
			
		||||
         << pred_text << "(" << e1 << ", " << e2 << ", " << e3
 | 
			
		||||
         << ") evaluates to false, where"
 | 
			
		||||
         << "\n"
 | 
			
		||||
         << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
 | 
			
		||||
         << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
 | 
			
		||||
         << e3 << " evaluates to " << ::testing::PrintToString(v3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
 | 
			
		||||
@ -242,15 +245,14 @@ AssertionResult AssertPred4Helper(const char* pred_text,
 | 
			
		||||
                                  const T4& v4) {
 | 
			
		||||
  if (pred(v1, v2, v3, v4)) return AssertionSuccess();
 | 
			
		||||
 | 
			
		||||
  return AssertionFailure() << pred_text << "("
 | 
			
		||||
                            << e1 << ", "
 | 
			
		||||
                            << e2 << ", "
 | 
			
		||||
                            << e3 << ", "
 | 
			
		||||
                            << e4 << ") evaluates to false, where"
 | 
			
		||||
                            << "\n" << e1 << " evaluates to " << v1
 | 
			
		||||
                            << "\n" << e2 << " evaluates to " << v2
 | 
			
		||||
                            << "\n" << e3 << " evaluates to " << v3
 | 
			
		||||
                            << "\n" << e4 << " evaluates to " << v4;
 | 
			
		||||
  return AssertionFailure()
 | 
			
		||||
         << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4
 | 
			
		||||
         << ") evaluates to false, where"
 | 
			
		||||
         << "\n"
 | 
			
		||||
         << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
 | 
			
		||||
         << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
 | 
			
		||||
         << e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n"
 | 
			
		||||
         << e4 << " evaluates to " << ::testing::PrintToString(v4);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
 | 
			
		||||
@ -307,17 +309,15 @@ AssertionResult AssertPred5Helper(const char* pred_text,
 | 
			
		||||
                                  const T5& v5) {
 | 
			
		||||
  if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
 | 
			
		||||
 | 
			
		||||
  return AssertionFailure() << pred_text << "("
 | 
			
		||||
                            << e1 << ", "
 | 
			
		||||
                            << e2 << ", "
 | 
			
		||||
                            << e3 << ", "
 | 
			
		||||
                            << e4 << ", "
 | 
			
		||||
                            << e5 << ") evaluates to false, where"
 | 
			
		||||
                            << "\n" << e1 << " evaluates to " << v1
 | 
			
		||||
                            << "\n" << e2 << " evaluates to " << v2
 | 
			
		||||
                            << "\n" << e3 << " evaluates to " << v3
 | 
			
		||||
                            << "\n" << e4 << " evaluates to " << v4
 | 
			
		||||
                            << "\n" << e5 << " evaluates to " << v5;
 | 
			
		||||
  return AssertionFailure()
 | 
			
		||||
         << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4
 | 
			
		||||
         << ", " << e5 << ") evaluates to false, where"
 | 
			
		||||
         << "\n"
 | 
			
		||||
         << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
 | 
			
		||||
         << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
 | 
			
		||||
         << e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n"
 | 
			
		||||
         << e4 << " evaluates to " << ::testing::PrintToString(v4) << "\n"
 | 
			
		||||
         << e5 << " evaluates to " << ::testing::PrintToString(v5);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,7 @@
 | 
			
		||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
			
		||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
// This file is AUTOMATICALLY GENERATED on 01/02/2018 by command
 | 
			
		||||
// This file is AUTOMATICALLY GENERATED on 01/02/2019 by command
 | 
			
		||||
// 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
 | 
			
		||||
 | 
			
		||||
// Regression test for gtest_pred_impl.h
 | 
			
		||||
 | 
			
		||||
@ -2357,6 +2357,16 @@ TEST(PredTest, SingleEvaluationOnFailure) {
 | 
			
		||||
  EXPECT_EQ(1, n4) << "Argument 4 is not evaluated exactly once.";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Test predicate assertions for sets
 | 
			
		||||
TEST(PredTest, ExpectPredEvalFailure) {
 | 
			
		||||
  std::set<int> set_a = {2, 1, 3, 4, 5};
 | 
			
		||||
  std::set<int> set_b = {0, 4, 8};
 | 
			
		||||
  const auto compare_sets = [] (std::set<int>, std::set<int>) { return false; };
 | 
			
		||||
  EXPECT_NONFATAL_FAILURE(
 | 
			
		||||
      EXPECT_PRED2(compare_sets, set_a, set_b),
 | 
			
		||||
      "compare_sets(set_a, set_b) evaluates to false, where\nset_a evaluates "
 | 
			
		||||
      "to { 1, 2, 3, 4, 5 }\nset_b evaluates to { 0, 4, 8 }");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Some helper functions for testing using overloaded/template
 | 
			
		||||
// functions with ASSERT_PREDn and EXPECT_PREDn.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user