Warning, /include/absl/log/check_test_impl.inc is written in an unsupported language. File is not indexed.
0001 //
0002 // Copyright 2022 The Abseil Authors.
0003 //
0004 // Licensed under the Apache License, Version 2.0 (the "License");
0005 // you may not use this file except in compliance with the License.
0006 // You may obtain a copy of the License at
0007 //
0008 // https://www.apache.org/licenses/LICENSE-2.0
0009 //
0010 // Unless required by applicable law or agreed to in writing, software
0011 // distributed under the License is distributed on an "AS IS" BASIS,
0012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013 // See the License for the specific language governing permissions and
0014 // limitations under the License.
0015
0016 #ifndef ABSL_LOG_CHECK_TEST_IMPL_H_
0017 #define ABSL_LOG_CHECK_TEST_IMPL_H_
0018
0019 // Verify that both sets of macros behave identically by parameterizing the
0020 // entire test file.
0021 #ifndef ABSL_TEST_CHECK
0022 #error ABSL_TEST_CHECK must be defined for these tests to work.
0023 #endif
0024
0025 #include <ostream>
0026 #include <string>
0027
0028 #include "gmock/gmock.h"
0029 #include "gtest/gtest.h"
0030 #include "absl/base/attributes.h"
0031 #include "absl/base/config.h"
0032 #include "absl/log/internal/test_helpers.h"
0033 #include "absl/status/status.h"
0034
0035 // NOLINTBEGIN(misc-definitions-in-headers)
0036
0037 namespace absl_log_internal {
0038
0039 using ::testing::AllOf;
0040 using ::testing::HasSubstr;
0041 using ::testing::Not;
0042
0043 auto* test_env ABSL_ATTRIBUTE_UNUSED = ::testing::AddGlobalTestEnvironment(
0044 new absl::log_internal::LogTestEnvironment);
0045
0046 #if GTEST_HAS_DEATH_TEST
0047
0048 TEST(CHECKDeathTest, TestBasicValues) {
0049 ABSL_TEST_CHECK(true);
0050
0051 EXPECT_DEATH(ABSL_TEST_CHECK(false), "Check failed: false");
0052
0053 int i = 2;
0054 ABSL_TEST_CHECK(i != 3); // NOLINT
0055 }
0056
0057 #endif // GTEST_HAS_DEATH_TEST
0058
0059 TEST(CHECKTest, TestLogicExpressions) {
0060 int i = 5;
0061 ABSL_TEST_CHECK(i > 0 && i < 10);
0062 ABSL_TEST_CHECK(i < 0 || i > 3);
0063 }
0064
0065 #if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
0066 ABSL_CONST_INIT const auto global_var_check = [](int i) {
0067 ABSL_TEST_CHECK(i > 0); // NOLINT
0068 return i + 1;
0069 }(3);
0070
0071 ABSL_CONST_INIT const auto global_var = [](int i) {
0072 ABSL_TEST_CHECK_GE(i, 0); // NOLINT
0073 return i + 1;
0074 }(global_var_check);
0075 #endif // ABSL_INTERNAL_CPLUSPLUS_LANG
0076
0077 TEST(CHECKTest, TestPlacementsInCompoundStatements) {
0078 // check placement inside if/else clauses
0079 if (true) ABSL_TEST_CHECK(true);
0080
0081 if (false)
0082 ; // NOLINT
0083 else
0084 ABSL_TEST_CHECK(true);
0085
0086 switch (0)
0087 case 0:
0088 ABSL_TEST_CHECK(true); // NOLINT
0089
0090 #if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
0091 constexpr auto var = [](int i) {
0092 ABSL_TEST_CHECK(i > 0); // NOLINT
0093 return i + 1;
0094 }(global_var);
0095 (void)var;
0096 #endif // ABSL_INTERNAL_CPLUSPLUS_LANG
0097 }
0098
0099 TEST(CHECKTest, TestBoolConvertible) {
0100 struct Tester {
0101 } tester;
0102 ABSL_TEST_CHECK([&]() { return &tester; }());
0103 }
0104
0105 #if GTEST_HAS_DEATH_TEST
0106
0107 TEST(CHECKDeathTest, TestChecksWithSideEffects) {
0108 int var = 0;
0109 ABSL_TEST_CHECK([&var]() {
0110 ++var;
0111 return true;
0112 }());
0113 EXPECT_EQ(var, 1);
0114
0115 EXPECT_DEATH(ABSL_TEST_CHECK([&var]() {
0116 ++var;
0117 return false;
0118 }()) << var,
0119 "Check failed: .* 2");
0120 }
0121
0122 #endif // GTEST_HAS_DEATH_TEST
0123
0124 template <int a, int b>
0125 constexpr int sum() {
0126 return a + b;
0127 }
0128 #define MACRO_ONE 1
0129 #define TEMPLATE_SUM(a, b) sum<a, b>()
0130 #define CONCAT(a, b) a b
0131 #define IDENTITY(x) x
0132
0133 TEST(CHECKTest, TestPassingMacroExpansion) {
0134 ABSL_TEST_CHECK(IDENTITY(true));
0135 ABSL_TEST_CHECK_EQ(TEMPLATE_SUM(MACRO_ONE, 2), 3);
0136 ABSL_TEST_CHECK_STREQ(CONCAT("x", "y"), "xy");
0137 }
0138
0139 #if GTEST_HAS_DEATH_TEST
0140
0141 TEST(CHECKTest, TestMacroExpansionInMessage) {
0142 auto MessageGen = []() { ABSL_TEST_CHECK(IDENTITY(false)); };
0143 EXPECT_DEATH(MessageGen(), HasSubstr("IDENTITY(false)"));
0144 }
0145
0146 TEST(CHECKTest, TestNestedMacroExpansionInMessage) {
0147 EXPECT_DEATH(ABSL_TEST_CHECK(IDENTITY(false)), HasSubstr("IDENTITY(false)"));
0148 }
0149
0150 TEST(CHECKTest, TestMacroExpansionCompare) {
0151 EXPECT_DEATH(ABSL_TEST_CHECK_EQ(IDENTITY(false), IDENTITY(true)),
0152 HasSubstr("IDENTITY(false) == IDENTITY(true)"));
0153 EXPECT_DEATH(ABSL_TEST_CHECK_GT(IDENTITY(1), IDENTITY(2)),
0154 HasSubstr("IDENTITY(1) > IDENTITY(2)"));
0155 }
0156
0157 TEST(CHECKTest, TestMacroExpansionStrCompare) {
0158 EXPECT_DEATH(ABSL_TEST_CHECK_STREQ(IDENTITY("x"), IDENTITY("y")),
0159 HasSubstr("IDENTITY(\"x\") == IDENTITY(\"y\")"));
0160 EXPECT_DEATH(ABSL_TEST_CHECK_STRCASENE(IDENTITY("a"), IDENTITY("A")),
0161 HasSubstr("IDENTITY(\"a\") != IDENTITY(\"A\")"));
0162 }
0163
0164 TEST(CHECKTest, TestMacroExpansionStatus) {
0165 EXPECT_DEATH(
0166 ABSL_TEST_CHECK_OK(IDENTITY(absl::FailedPreconditionError("message"))),
0167 HasSubstr("IDENTITY(absl::FailedPreconditionError(\"message\"))"));
0168 }
0169
0170 TEST(CHECKTest, TestMacroExpansionComma) {
0171 EXPECT_DEATH(ABSL_TEST_CHECK(TEMPLATE_SUM(MACRO_ONE, 2) == 4),
0172 HasSubstr("TEMPLATE_SUM(MACRO_ONE, 2) == 4"));
0173 }
0174
0175 TEST(CHECKTest, TestMacroExpansionCommaCompare) {
0176 EXPECT_DEATH(
0177 ABSL_TEST_CHECK_EQ(TEMPLATE_SUM(2, MACRO_ONE), TEMPLATE_SUM(3, 2)),
0178 HasSubstr("TEMPLATE_SUM(2, MACRO_ONE) == TEMPLATE_SUM(3, 2)"));
0179 EXPECT_DEATH(
0180 ABSL_TEST_CHECK_GT(TEMPLATE_SUM(2, MACRO_ONE), TEMPLATE_SUM(3, 2)),
0181 HasSubstr("TEMPLATE_SUM(2, MACRO_ONE) > TEMPLATE_SUM(3, 2)"));
0182 }
0183
0184 TEST(CHECKTest, TestMacroExpansionCommaStrCompare) {
0185 EXPECT_DEATH(ABSL_TEST_CHECK_STREQ(CONCAT("x", "y"), "z"),
0186 HasSubstr("CONCAT(\"x\", \"y\") == \"z\""));
0187 EXPECT_DEATH(ABSL_TEST_CHECK_STRNE(CONCAT("x", "y"), "xy"),
0188 HasSubstr("CONCAT(\"x\", \"y\") != \"xy\""));
0189 }
0190
0191 #endif // GTEST_HAS_DEATH_TEST
0192
0193 #undef TEMPLATE_SUM
0194 #undef CONCAT
0195 #undef MACRO
0196 #undef ONE
0197
0198 #if GTEST_HAS_DEATH_TEST
0199
0200 TEST(CHECKDeachTest, TestOrderOfInvocationsBetweenCheckAndMessage) {
0201 int counter = 0;
0202
0203 auto GetStr = [&counter]() -> std::string {
0204 return counter++ == 0 ? "" : "non-empty";
0205 };
0206
0207 EXPECT_DEATH(ABSL_TEST_CHECK(!GetStr().empty()) << GetStr(),
0208 HasSubstr("non-empty"));
0209 }
0210
0211 TEST(CHECKTest, TestSecondaryFailure) {
0212 auto FailingRoutine = []() {
0213 ABSL_TEST_CHECK(false) << "Secondary";
0214 return false;
0215 };
0216 EXPECT_DEATH(ABSL_TEST_CHECK(FailingRoutine()) << "Primary",
0217 AllOf(HasSubstr("Secondary"), Not(HasSubstr("Primary"))));
0218 }
0219
0220 TEST(CHECKTest, TestSecondaryFailureInMessage) {
0221 auto MessageGen = []() {
0222 ABSL_TEST_CHECK(false) << "Secondary";
0223 return "Primary";
0224 };
0225 EXPECT_DEATH(ABSL_TEST_CHECK(false) << MessageGen(),
0226 AllOf(HasSubstr("Secondary"), Not(HasSubstr("Primary"))));
0227 }
0228
0229 #endif // GTEST_HAS_DEATH_TEST
0230
0231 TEST(CHECKTest, TestBinaryChecksWithPrimitives) {
0232 ABSL_TEST_CHECK_EQ(1, 1);
0233 ABSL_TEST_CHECK_NE(1, 2);
0234 ABSL_TEST_CHECK_GE(1, 1);
0235 ABSL_TEST_CHECK_GE(2, 1);
0236 ABSL_TEST_CHECK_LE(1, 1);
0237 ABSL_TEST_CHECK_LE(1, 2);
0238 ABSL_TEST_CHECK_GT(2, 1);
0239 ABSL_TEST_CHECK_LT(1, 2);
0240 }
0241
0242 // For testing using CHECK*() on anonymous enums.
0243 enum { CASE_A, CASE_B };
0244
0245 TEST(CHECKTest, TestBinaryChecksWithEnumValues) {
0246 // Tests using CHECK*() on anonymous enums.
0247 ABSL_TEST_CHECK_EQ(CASE_A, CASE_A);
0248 ABSL_TEST_CHECK_NE(CASE_A, CASE_B);
0249 ABSL_TEST_CHECK_GE(CASE_A, CASE_A);
0250 ABSL_TEST_CHECK_GE(CASE_B, CASE_A);
0251 ABSL_TEST_CHECK_LE(CASE_A, CASE_A);
0252 ABSL_TEST_CHECK_LE(CASE_A, CASE_B);
0253 ABSL_TEST_CHECK_GT(CASE_B, CASE_A);
0254 ABSL_TEST_CHECK_LT(CASE_A, CASE_B);
0255 }
0256
0257 TEST(CHECKTest, TestBinaryChecksWithNullptr) {
0258 const void* p_null = nullptr;
0259 const void* p_not_null = &p_null;
0260 ABSL_TEST_CHECK_EQ(p_null, nullptr);
0261 ABSL_TEST_CHECK_EQ(nullptr, p_null);
0262 ABSL_TEST_CHECK_NE(p_not_null, nullptr);
0263 ABSL_TEST_CHECK_NE(nullptr, p_not_null);
0264 }
0265
0266 #if GTEST_HAS_DEATH_TEST
0267
0268 // Test logging of various char-typed values by failing CHECK*().
0269 TEST(CHECKDeathTest, TestComparingCharsValues) {
0270 {
0271 char a = ';';
0272 char b = 'b';
0273 EXPECT_DEATH(ABSL_TEST_CHECK_EQ(a, b),
0274 "Check failed: a == b \\(';' vs. 'b'\\)");
0275 b = 1;
0276 EXPECT_DEATH(ABSL_TEST_CHECK_EQ(a, b),
0277 "Check failed: a == b \\(';' vs. char value 1\\)");
0278 }
0279 {
0280 signed char a = ';';
0281 signed char b = 'b';
0282 EXPECT_DEATH(ABSL_TEST_CHECK_EQ(a, b),
0283 "Check failed: a == b \\(';' vs. 'b'\\)");
0284 b = -128;
0285 EXPECT_DEATH(ABSL_TEST_CHECK_EQ(a, b),
0286 "Check failed: a == b \\(';' vs. signed char value -128\\)");
0287 }
0288 {
0289 unsigned char a = ';';
0290 unsigned char b = 'b';
0291 EXPECT_DEATH(ABSL_TEST_CHECK_EQ(a, b),
0292 "Check failed: a == b \\(';' vs. 'b'\\)");
0293 b = 128;
0294 EXPECT_DEATH(ABSL_TEST_CHECK_EQ(a, b),
0295 "Check failed: a == b \\(';' vs. unsigned char value 128\\)");
0296 }
0297 }
0298
0299 TEST(CHECKDeathTest, TestNullValuesAreReportedCleanly) {
0300 const char* a = nullptr;
0301 const char* b = nullptr;
0302 EXPECT_DEATH(ABSL_TEST_CHECK_NE(a, b),
0303 "Check failed: a != b \\(\\(null\\) vs. \\(null\\)\\)");
0304
0305 a = "xx";
0306 EXPECT_DEATH(ABSL_TEST_CHECK_EQ(a, b),
0307 "Check failed: a == b \\(xx vs. \\(null\\)\\)");
0308 EXPECT_DEATH(ABSL_TEST_CHECK_EQ(b, a),
0309 "Check failed: b == a \\(\\(null\\) vs. xx\\)");
0310
0311 std::nullptr_t n{};
0312 EXPECT_DEATH(ABSL_TEST_CHECK_NE(n, nullptr),
0313 "Check failed: n != nullptr \\(\\(null\\) vs. \\(null\\)\\)");
0314 }
0315
0316 #endif // GTEST_HAS_DEATH_TEST
0317
0318 TEST(CHECKTest, TestSTREQ) {
0319 ABSL_TEST_CHECK_STREQ("this", "this");
0320 ABSL_TEST_CHECK_STREQ(nullptr, nullptr);
0321 ABSL_TEST_CHECK_STRCASEEQ("this", "tHiS");
0322 ABSL_TEST_CHECK_STRCASEEQ(nullptr, nullptr);
0323 ABSL_TEST_CHECK_STRNE("this", "tHiS");
0324 ABSL_TEST_CHECK_STRNE("this", nullptr);
0325 ABSL_TEST_CHECK_STRCASENE("this", "that");
0326 ABSL_TEST_CHECK_STRCASENE(nullptr, "that");
0327 ABSL_TEST_CHECK_STREQ((std::string("a") + "b").c_str(), "ab");
0328 ABSL_TEST_CHECK_STREQ(std::string("test").c_str(),
0329 (std::string("te") + std::string("st")).c_str());
0330 }
0331
0332 TEST(CHECKTest, TestComparisonPlacementsInCompoundStatements) {
0333 // check placement inside if/else clauses
0334 if (true) ABSL_TEST_CHECK_EQ(1, 1);
0335 if (true) ABSL_TEST_CHECK_STREQ("c", "c");
0336
0337 if (false)
0338 ; // NOLINT
0339 else
0340 ABSL_TEST_CHECK_LE(0, 1);
0341
0342 if (false)
0343 ; // NOLINT
0344 else
0345 ABSL_TEST_CHECK_STRNE("a", "b");
0346
0347 switch (0)
0348 case 0:
0349 ABSL_TEST_CHECK_NE(1, 0);
0350
0351 switch (0)
0352 case 0:
0353 ABSL_TEST_CHECK_STRCASEEQ("A", "a");
0354
0355 #if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
0356 constexpr auto var = [](int i) {
0357 ABSL_TEST_CHECK_GT(i, 0);
0358 return i + 1;
0359 }(global_var);
0360 (void)var;
0361
0362 // CHECK_STR... checks are not supported in constexpr routines.
0363 // constexpr auto var2 = [](int i) {
0364 // ABSL_TEST_CHECK_STRNE("c", "d");
0365 // return i + 1;
0366 // }(global_var);
0367
0368 #if defined(__GNUC__)
0369 int var3 = (({ ABSL_TEST_CHECK_LE(1, 2); }), global_var < 10) ? 1 : 0;
0370 (void)var3;
0371
0372 int var4 = (({ ABSL_TEST_CHECK_STREQ("a", "a"); }), global_var < 10) ? 1 : 0;
0373 (void)var4;
0374 #endif // __GNUC__
0375 #endif // ABSL_INTERNAL_CPLUSPLUS_LANG
0376 }
0377
0378 TEST(CHECKTest, TestDCHECK) {
0379 #ifdef NDEBUG
0380 ABSL_TEST_DCHECK(1 == 2) << " DCHECK's shouldn't be compiled in normal mode";
0381 #endif
0382 ABSL_TEST_DCHECK(1 == 1); // NOLINT(readability/check)
0383 ABSL_TEST_DCHECK_EQ(1, 1);
0384 ABSL_TEST_DCHECK_NE(1, 2);
0385 ABSL_TEST_DCHECK_GE(1, 1);
0386 ABSL_TEST_DCHECK_GE(2, 1);
0387 ABSL_TEST_DCHECK_LE(1, 1);
0388 ABSL_TEST_DCHECK_LE(1, 2);
0389 ABSL_TEST_DCHECK_GT(2, 1);
0390 ABSL_TEST_DCHECK_LT(1, 2);
0391
0392 // Test DCHECK on std::nullptr_t
0393 const void* p_null = nullptr;
0394 const void* p_not_null = &p_null;
0395 ABSL_TEST_DCHECK_EQ(p_null, nullptr);
0396 ABSL_TEST_DCHECK_EQ(nullptr, p_null);
0397 ABSL_TEST_DCHECK_NE(p_not_null, nullptr);
0398 ABSL_TEST_DCHECK_NE(nullptr, p_not_null);
0399 }
0400
0401 TEST(CHECKTest, TestQCHECK) {
0402 // The tests that QCHECK does the same as CHECK
0403 ABSL_TEST_QCHECK(1 == 1); // NOLINT(readability/check)
0404 ABSL_TEST_QCHECK_EQ(1, 1);
0405 ABSL_TEST_QCHECK_NE(1, 2);
0406 ABSL_TEST_QCHECK_GE(1, 1);
0407 ABSL_TEST_QCHECK_GE(2, 1);
0408 ABSL_TEST_QCHECK_LE(1, 1);
0409 ABSL_TEST_QCHECK_LE(1, 2);
0410 ABSL_TEST_QCHECK_GT(2, 1);
0411 ABSL_TEST_QCHECK_LT(1, 2);
0412
0413 // Tests using QCHECK*() on anonymous enums.
0414 ABSL_TEST_QCHECK_EQ(CASE_A, CASE_A);
0415 ABSL_TEST_QCHECK_NE(CASE_A, CASE_B);
0416 ABSL_TEST_QCHECK_GE(CASE_A, CASE_A);
0417 ABSL_TEST_QCHECK_GE(CASE_B, CASE_A);
0418 ABSL_TEST_QCHECK_LE(CASE_A, CASE_A);
0419 ABSL_TEST_QCHECK_LE(CASE_A, CASE_B);
0420 ABSL_TEST_QCHECK_GT(CASE_B, CASE_A);
0421 ABSL_TEST_QCHECK_LT(CASE_A, CASE_B);
0422 }
0423
0424 TEST(CHECKTest, TestQCHECKPlacementsInCompoundStatements) {
0425 // check placement inside if/else clauses
0426 if (true) ABSL_TEST_QCHECK(true);
0427
0428 if (false)
0429 ; // NOLINT
0430 else
0431 ABSL_TEST_QCHECK(true);
0432
0433 if (false)
0434 ; // NOLINT
0435 else
0436 ABSL_TEST_QCHECK(true);
0437
0438 switch (0)
0439 case 0:
0440 ABSL_TEST_QCHECK(true);
0441
0442 #if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
0443 constexpr auto var = [](int i) {
0444 ABSL_TEST_QCHECK(i > 0); // NOLINT
0445 return i + 1;
0446 }(global_var);
0447 (void)var;
0448
0449 #if defined(__GNUC__)
0450 int var2 = (({ ABSL_TEST_CHECK_LE(1, 2); }), global_var < 10) ? 1 : 0;
0451 (void)var2;
0452 #endif // __GNUC__
0453 #endif // ABSL_INTERNAL_CPLUSPLUS_LANG
0454 }
0455
0456 class ComparableType {
0457 public:
0458 explicit ComparableType(int v) : v_(v) {}
0459
0460 void MethodWithCheck(int i) {
0461 ABSL_TEST_CHECK_EQ(*this, i);
0462 ABSL_TEST_CHECK_EQ(i, *this);
0463 }
0464
0465 int Get() const { return v_; }
0466
0467 private:
0468 friend bool operator==(const ComparableType& lhs, const ComparableType& rhs) {
0469 return lhs.v_ == rhs.v_;
0470 }
0471 friend bool operator!=(const ComparableType& lhs, const ComparableType& rhs) {
0472 return lhs.v_ != rhs.v_;
0473 }
0474 friend bool operator<(const ComparableType& lhs, const ComparableType& rhs) {
0475 return lhs.v_ < rhs.v_;
0476 }
0477 friend bool operator<=(const ComparableType& lhs, const ComparableType& rhs) {
0478 return lhs.v_ <= rhs.v_;
0479 }
0480 friend bool operator>(const ComparableType& lhs, const ComparableType& rhs) {
0481 return lhs.v_ > rhs.v_;
0482 }
0483 friend bool operator>=(const ComparableType& lhs, const ComparableType& rhs) {
0484 return lhs.v_ >= rhs.v_;
0485 }
0486 friend bool operator==(const ComparableType& lhs, int rhs) {
0487 return lhs.v_ == rhs;
0488 }
0489 friend bool operator==(int lhs, const ComparableType& rhs) {
0490 return lhs == rhs.v_;
0491 }
0492
0493 friend std::ostream& operator<<(std::ostream& out, const ComparableType& v) {
0494 return out << "ComparableType{" << v.Get() << "}";
0495 }
0496
0497 int v_;
0498 };
0499
0500 TEST(CHECKTest, TestUserDefinedCompOp) {
0501 ABSL_TEST_CHECK_EQ(ComparableType{0}, ComparableType{0});
0502 ABSL_TEST_CHECK_NE(ComparableType{1}, ComparableType{2});
0503 ABSL_TEST_CHECK_LT(ComparableType{1}, ComparableType{2});
0504 ABSL_TEST_CHECK_LE(ComparableType{1}, ComparableType{2});
0505 ABSL_TEST_CHECK_GT(ComparableType{2}, ComparableType{1});
0506 ABSL_TEST_CHECK_GE(ComparableType{2}, ComparableType{2});
0507 }
0508
0509 TEST(CHECKTest, TestCheckInMethod) {
0510 ComparableType v{1};
0511 v.MethodWithCheck(1);
0512 }
0513
0514 TEST(CHECKDeathTest, TestUserDefinedStreaming) {
0515 ComparableType v1{1};
0516 ComparableType v2{2};
0517
0518 EXPECT_DEATH(
0519 ABSL_TEST_CHECK_EQ(v1, v2),
0520 HasSubstr(
0521 "Check failed: v1 == v2 (ComparableType{1} vs. ComparableType{2})"));
0522 }
0523
0524 } // namespace absl_log_internal
0525
0526 // NOLINTEND(misc-definitions-in-headers)
0527
0528 #endif // ABSL_LOG_CHECK_TEST_IMPL_H_