MdePkg: Add MockHash2 Protocol for testing
This commit adds a new MockHash2 protocol to the MdePkg. This allows the unit tests to pick up the new protocol and use it for testing. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
27
MdePkg/Test/Mock/Library/GoogleTest/Protocol/MockHash2.cpp
Normal file
27
MdePkg/Test/Mock/Library/GoogleTest/Protocol/MockHash2.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
/** @file MockHash2.cpp
|
||||
Google Test mock for Hash2 Protocol
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#include <GoogleTest/Protocol/MockHash2.h>
|
||||
|
||||
MOCK_INTERFACE_DEFINITION (MockHash2);
|
||||
MOCK_FUNCTION_DEFINITION (MockHash2, GetHashSize, 3, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION (MockHash2, Hash, 5, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION (MockHash2, HashInit, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION (MockHash2, HashUpdate, 3, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION (MockHash2, HashFinal, 2, EFIAPI);
|
||||
|
||||
EFI_HASH2_PROTOCOL HASH2_PROTOCOL_INSTANCE = {
|
||||
GetHashSize, // EFI_HASH2_GET_HASH_SIZE
|
||||
Hash, // EFI_HASH2_HASH
|
||||
HashInit, // EFI_HASH2_HASH_INIT
|
||||
HashUpdate, // EFI_HASH2_HASH_UPDATE
|
||||
HashFinal // EFI_HASH2_HASH_FINAL
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
EFI_HASH2_PROTOCOL *gHash2Protocol = &HASH2_PROTOCOL_INSTANCE;
|
||||
}
|
Reference in New Issue
Block a user