summaryrefslogtreecommitdiff
path: root/absl/container/internal
diff options
context:
space:
mode:
authorGravatar Andy Getzendanner <durandal@google.com>2023-05-23 15:46:35 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-05-23 15:47:23 -0700
commit52747821480e6cadd8b27a0947af5d7933f9dfb4 (patch)
treecc42f6dc30fa8eca19047efd799c769ead59b6c4 /absl/container/internal
parent79ca5d7aad63973c83a4962a66ab07cd623131ea (diff)
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/container/internal')
-rw-r--r--absl/container/internal/layout_test.cc36
-rw-r--r--absl/container/internal/raw_hash_set_test.cc5
2 files changed, 20 insertions, 21 deletions
diff --git a/absl/container/internal/layout_test.cc b/absl/container/internal/layout_test.cc
index 54e5d5bb..ce599ce7 100644
--- a/absl/container/internal/layout_test.cc
+++ b/absl/container/internal/layout_test.cc
@@ -26,7 +26,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/config.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/check.h"
#include "absl/types/span.h"
namespace absl {
@@ -38,7 +38,7 @@ using ::absl::Span;
using ::testing::ElementsAre;
size_t Distance(const void* from, const void* to) {
- ABSL_RAW_CHECK(from <= to, "Distance must be non-negative");
+ CHECK_LE(from, to) << "Distance must be non-negative";
return static_cast<const char*>(to) - static_cast<const char*>(from);
}
@@ -366,7 +366,7 @@ TEST(Layout, Sizes) {
}
TEST(Layout, PointerByIndex) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<const int32_t*>(L::Partial().Pointer<0>(p))));
@@ -447,7 +447,7 @@ TEST(Layout, PointerByIndex) {
}
TEST(Layout, PointerByType) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
@@ -526,7 +526,7 @@ TEST(Layout, PointerByType) {
}
TEST(Layout, MutablePointerByIndex) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial().Pointer<0>(p))));
@@ -581,7 +581,7 @@ TEST(Layout, MutablePointerByIndex) {
}
TEST(Layout, MutablePointerByType) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial().Pointer<int32_t>(p))));
@@ -647,7 +647,7 @@ TEST(Layout, MutablePointerByType) {
}
TEST(Layout, Pointers) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
@@ -683,7 +683,7 @@ TEST(Layout, Pointers) {
}
TEST(Layout, MutablePointers) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
@@ -716,7 +716,7 @@ TEST(Layout, MutablePointers) {
}
TEST(Layout, SliceByIndexSize) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<0>(p).size());
@@ -744,7 +744,7 @@ TEST(Layout, SliceByIndexSize) {
}
TEST(Layout, SliceByTypeSize) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<int32_t>(p).size());
@@ -766,7 +766,7 @@ TEST(Layout, SliceByTypeSize) {
}
TEST(Layout, MutableSliceByIndexSize) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<0>(p).size());
@@ -794,7 +794,7 @@ TEST(Layout, MutableSliceByIndexSize) {
}
TEST(Layout, MutableSliceByTypeSize) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<int32_t>(p).size());
@@ -816,7 +816,7 @@ TEST(Layout, MutableSliceByTypeSize) {
}
TEST(Layout, SliceByIndexData) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
@@ -939,7 +939,7 @@ TEST(Layout, SliceByIndexData) {
}
TEST(Layout, SliceByTypeData) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
@@ -1037,7 +1037,7 @@ TEST(Layout, SliceByTypeData) {
}
TEST(Layout, MutableSliceByIndexData) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
@@ -1122,7 +1122,7 @@ TEST(Layout, MutableSliceByIndexData) {
}
TEST(Layout, MutableSliceByTypeData) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
@@ -1268,7 +1268,7 @@ testing::PolymorphicMatcher<TupleMatcher<M...>> Tuple(M... matchers) {
}
TEST(Layout, Slices) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
@@ -1302,7 +1302,7 @@ TEST(Layout, Slices) {
}
TEST(Layout, MutableSlices) {
- alignas(max_align_t) unsigned char p[100] = {};
+ alignas(max_align_t) unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
diff --git a/absl/container/internal/raw_hash_set_test.cc b/absl/container/internal/raw_hash_set_test.cc
index c46a5939..ce1070ba 100644
--- a/absl/container/internal/raw_hash_set_test.cc
+++ b/absl/container/internal/raw_hash_set_test.cc
@@ -40,7 +40,6 @@
#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/base/internal/cycleclock.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/prefetch.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
@@ -1280,7 +1279,7 @@ ExpectedStats XorSeedExpectedStats() {
{{0.95, 0}, {0.99, 1}, {0.999, 4}, {0.9999, 10}}};
}
}
- ABSL_RAW_LOG(FATAL, "%s", "Unknown Group width");
+ LOG(FATAL) << "Unknown Group width";
return {};
}
@@ -1376,7 +1375,7 @@ ExpectedStats LinearTransformExpectedStats() {
{{0.95, 0}, {0.99, 1}, {0.999, 6}, {0.9999, 10}}};
}
}
- ABSL_RAW_LOG(FATAL, "%s", "Unknown Group width");
+ LOG(FATAL) << "Unknown Group width";
return {};
}