/** @file This is a sample to demonstrates the use of GoogleTest that supports host execution environments. Copyright (c) 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include extern "C" { #include #include #include #include #include } UINTN DivideWithNoParameterChecking ( UINTN Dividend, UINTN Divisor ) { // // Perform integer division with no check for divide by zero // return (Dividend / Divisor); } /** Sample unit test that performs a divide by 0 **/ TEST (SanitizerTests, DivideByZeroDeathTest) { // // Divide by 0 should be caught by address sanitizer, log details, and exit // EXPECT_DEATH (DivideWithNoParameterChecking (10, 0), "ERROR: AddressSanitizer: "); }