gfe-relnote: (n/a) Add a wrapper macro for quic::test::ExpectApproxEq for better error report in tests. Test only.

The new EXPECT_APPROX_EQ macro shows the filename:linenumber of the callsite, the existing function does not.

PiperOrigin-RevId: 246420815
Change-Id: Ife5706cf77261a4f1d120946f4d0acd400076afd
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h
index 08337da..91f25d5 100644
--- a/quic/test_tools/quic_test_utils.h
+++ b/quic/test_tools/quic_test_utils.h
@@ -1128,7 +1128,8 @@
 
 // Verifies that the relative error of |actual| with respect to |expected| is
 // no more than |margin|.
-
+// Please use EXPECT_APPROX_EQ, a wrapper around this function, for better error
+// report.
 template <typename T>
 void ExpectApproxEq(T expected, T actual, float relative_margin) {
   // If |relative_margin| > 1 and T is an unsigned type, the comparison will
@@ -1138,10 +1139,16 @@
 
   T absolute_margin = expected * relative_margin;
 
-  EXPECT_GE(expected + absolute_margin, actual);
-  EXPECT_LE(expected - absolute_margin, actual);
+  EXPECT_GE(expected + absolute_margin, actual) << "actual value too big";
+  EXPECT_LE(expected - absolute_margin, actual) << "actual value too small";
 }
 
+#define EXPECT_APPROX_EQ(expected, actual, relative_margin)                    \
+  do {                                                                         \
+    SCOPED_TRACE(testing::Message() << "relative_margin:" << relative_margin); \
+    quic::test::ExpectApproxEq(expected, actual, relative_margin);             \
+  } while (0)
+
 template <typename T>
 QuicHeaderList AsHeaderList(const T& container) {
   QuicHeaderList l;