MdePkg: Add gmock examples
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4389 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: Chris Johnson <chris.n.johnson@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Oliver Smith-Denny <osde@linux.microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
e4af282e9f
commit
09458c2b0b
39
MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiLib.h
Normal file
39
MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiLib.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/** @file
|
||||
Google Test mocks for UefiLib
|
||||
|
||||
Copyright (c) 2022, Intel Corporation. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef MOCK_UEFI_LIB_H_
|
||||
#define MOCK_UEFI_LIB_H_
|
||||
|
||||
#include <Library/GoogleTestLib.h>
|
||||
#include <Library/FunctionMockLib.h>
|
||||
extern "C" {
|
||||
#include <Uefi.h>
|
||||
#include <Library/UefiLib.h>
|
||||
}
|
||||
|
||||
struct MockUefiLib {
|
||||
MOCK_INTERFACE_DECLARATION (MockUefiLib);
|
||||
|
||||
MOCK_FUNCTION_DECLARATION (
|
||||
EFI_STATUS,
|
||||
GetVariable2,
|
||||
(IN CONST CHAR16 *Name,
|
||||
IN CONST EFI_GUID *Guid,
|
||||
OUT VOID **Value,
|
||||
OUT UINTN *Size OPTIONAL)
|
||||
);
|
||||
|
||||
MOCK_FUNCTION_DECLARATION (
|
||||
EFI_STATUS,
|
||||
GetEfiGlobalVariable2,
|
||||
(IN CONST CHAR16 *Name,
|
||||
OUT VOID **Value,
|
||||
OUT UINTN *Size OPTIONAL)
|
||||
);
|
||||
};
|
||||
|
||||
#endif
|
@@ -0,0 +1,42 @@
|
||||
/** @file
|
||||
Google Test mocks for UefiRuntimeServicesTableLib
|
||||
|
||||
Copyright (c) 2022, Intel Corporation. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef MOCK_UEFI_RUNTIME_SERVICES_TABLE_LIB_H_
|
||||
#define MOCK_UEFI_RUNTIME_SERVICES_TABLE_LIB_H_
|
||||
|
||||
#include <Library/GoogleTestLib.h>
|
||||
#include <Library/FunctionMockLib.h>
|
||||
extern "C" {
|
||||
#include <Uefi.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
}
|
||||
|
||||
struct MockUefiRuntimeServicesTableLib {
|
||||
MOCK_INTERFACE_DECLARATION (MockUefiRuntimeServicesTableLib);
|
||||
|
||||
MOCK_FUNCTION_DECLARATION (
|
||||
EFI_STATUS,
|
||||
gRT_GetVariable,
|
||||
(IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes OPTIONAL,
|
||||
IN OUT UINTN *DataSize,
|
||||
OUT VOID *Data)
|
||||
);
|
||||
|
||||
MOCK_FUNCTION_DECLARATION (
|
||||
EFI_STATUS,
|
||||
gRT_SetVariable,
|
||||
(IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *Data)
|
||||
);
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user