UnitTestFrameworkPkg/GoogleTestLib: Enhance unit test NULL checks

gtest.h uses standard includes that define NULL to __null. This
is different that the C++ standard that uses nullptr. Redefine
NULL in GoogleTestLib.h to use C++ form of nullptr. This allows
NULL to be used in checks and mocks without explicit typecasts.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Michael D Kinney
2025-06-18 17:58:33 -07:00
committed by mergify[bot]
parent f93e6a0743
commit b4e5860fd5

View File

@@ -13,6 +13,15 @@
#include <gmock/gmock.h>
#include <cstring>
//
// For all use of GoogleTestLib, make sure NULL is defined to nullptr to
// support matching any unit test pointer value to NULL.
//
#ifdef NULL
#undef NULL
#define NULL nullptr
#endif
using ::testing::Throws;
using ::testing::ThrowsMessage;
using ::testing::HasSubstr;