diff options
author | Andy Getzendanner <durandal@google.com> | 2023-05-23 15:46:35 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-05-23 15:47:23 -0700 |
commit | 52747821480e6cadd8b27a0947af5d7933f9dfb4 (patch) | |
tree | cc42f6dc30fa8eca19047efd799c769ead59b6c4 /absl/random/gaussian_distribution_test.cc | |
parent | 79ca5d7aad63973c83a4962a66ab07cd623131ea (diff) | |
download | abseil-52747821480e6cadd8b27a0947af5d7933f9dfb4.tar.gz abseil-52747821480e6cadd8b27a0947af5d7933f9dfb4.tar.bz2 abseil-52747821480e6cadd8b27a0947af5d7933f9dfb4.zip |
Migrate most RAW_LOGs and RAW_CHECKs in tests to regular LOG and CHECK.
The non-RAW_ versions provide better output but weren't available when most of these tests were written.
There are just a couple spots where RAW_ is actually needed, e.g. signal handlers and malloc hooks.
Also fix a couple warnings in layout_test.cc newly surfaced because the optimizer understands CHECK_XX differently than INTERNAL_CHECK.
PiperOrigin-RevId: 534584435
Change-Id: I8d36fa809ffdaae5a3813064bd602cb8611c1613
Diffstat (limited to 'absl/random/gaussian_distribution_test.cc')
-rw-r--r-- | absl/random/gaussian_distribution_test.cc | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/absl/random/gaussian_distribution_test.cc b/absl/random/gaussian_distribution_test.cc index 4584ac92..bad3476f 100644 --- a/absl/random/gaussian_distribution_test.cc +++ b/absl/random/gaussian_distribution_test.cc @@ -26,8 +26,8 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#include "absl/base/internal/raw_logging.h" #include "absl/base/macros.h" +#include "absl/log/log.h" #include "absl/numeric/internal/representation.h" #include "absl/random/internal/chi_square.h" #include "absl/random/internal/distribution_test_util.h" @@ -116,9 +116,8 @@ TYPED_TEST(GaussianDistributionInterfaceTest, SerializeTest) { EXPECT_LE(sample, before.max()) << before; } if (!std::is_same<TypeParam, long double>::value) { - ABSL_INTERNAL_LOG( - INFO, absl::StrFormat("Range{%f, %f}: %f, %f", mean, stddev, - sample_min, sample_max)); + LOG(INFO) << "Range{" << mean << ", " << stddev << "}: " << sample_min + << ", " << sample_max; } std::stringstream ss; @@ -240,17 +239,16 @@ bool GaussianDistributionTests::SingleZTest(const double p, (std::pow(m.skewness, 2.0) + std::pow(m.kurtosis - 3.0, 2.0) / 4.0); if (!pass || jb > 9.21) { - ABSL_INTERNAL_LOG( - INFO, absl::StrFormat("p=%f max_err=%f\n" - " mean=%f vs. %f\n" - " stddev=%f vs. %f\n" - " skewness=%f vs. %f\n" - " kurtosis=%f vs. %f\n" - " z=%f vs. 0\n" - " jb=%f vs. 9.21", - p, max_err, m.mean, mean(), std::sqrt(m.variance), - stddev(), m.skewness, skew(), m.kurtosis, - kurtosis(), z, jb)); + // clang-format off + LOG(INFO) + << "p=" << p << " max_err=" << max_err << "\n" + " mean=" << m.mean << " vs. " << mean() << "\n" + " stddev=" << std::sqrt(m.variance) << " vs. " << stddev() << "\n" + " skewness=" << m.skewness << " vs. " << skew() << "\n" + " kurtosis=" << m.kurtosis << " vs. " << kurtosis() << "\n" + " z=" << z << " vs. 0\n" + " jb=" << jb << " vs. 9.21"; + // clang-format on } return pass; } @@ -297,16 +295,16 @@ double GaussianDistributionTests::SingleChiSquaredTest() { // Log if the chi_square value is above the threshold. if (chi_square > threshold) { - for (int i = 0; i < cutoffs.size(); i++) { - ABSL_INTERNAL_LOG( - INFO, absl::StrFormat("%d : (%f) = %d", i, cutoffs[i], counts[i])); + for (size_t i = 0; i < cutoffs.size(); i++) { + LOG(INFO) << i << " : (" << cutoffs[i] << ") = " << counts[i]; } - ABSL_INTERNAL_LOG( - INFO, absl::StrCat("mean=", mean(), " stddev=", stddev(), "\n", // - " expected ", expected, "\n", // - kChiSquared, " ", chi_square, " (", p, ")\n", // - kChiSquared, " @ 0.98 = ", threshold)); + // clang-format off + LOG(INFO) << "mean=" << mean() << " stddev=" << stddev() << "\n" + " expected " << expected << "\n" + << kChiSquared << " " << chi_square << " (" << p << ")\n" + << kChiSquared << " @ 0.98 = " << threshold; + // clang-format on } return p; } |