-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description Create Mock for PostCodeLib For details on how to complete these options and their meaning refer to [CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md). - [ ] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? - [x] Backport to release branch? ## How This Was Tested Unit tests component can call these mock functions success ## Integration Instructions N/A
- Loading branch information
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPostCodeLib.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** @file MockPostCodeLib.h | ||
Google Test mocks for PostCodeLib | ||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved. | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef MOCK_POST_CODE_LIB_H_ | ||
#define MOCK_POST_CODE_LIB_H_ | ||
|
||
#include <Library/GoogleTestLib.h> | ||
#include <Library/FunctionMockLib.h> | ||
extern "C" { | ||
#include <Uefi.h> | ||
#include <Library/PostCodeLib.h> | ||
} | ||
|
||
struct MockPostCodeLib { | ||
MOCK_INTERFACE_DECLARATION (MockPostCodeLib); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
UINT32, | ||
PostCode, | ||
( | ||
IN UINT32 Value | ||
) | ||
); | ||
MOCK_FUNCTION_DECLARATION ( | ||
UINT32, | ||
PostCodeWithDescription, | ||
( | ||
IN UINT32 Value, | ||
IN CONST CHAR8 *Description OPTIONAL | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
BOOLEAN, | ||
PostCodeEnabled, | ||
( | ||
|
||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
BOOLEAN, | ||
PostCodeDescriptionEnabled, | ||
( | ||
|
||
) | ||
); | ||
}; | ||
|
||
#endif //MOCK_PCI_EXPRESS_LIB_H_ |
14 changes: 14 additions & 0 deletions
14
MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** @file MockPostCodeLib.cpp | ||
Google Test mocks for PostCodeLib | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <GoogleTest/Library/MockPostCodeLib.h> | ||
|
||
MOCK_INTERFACE_DEFINITION (MockPostCodeLib); | ||
MOCK_FUNCTION_DEFINITION (MockPostCodeLib, PostCode, 1, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockPostCodeLib, PostCodeWithDescription, 2, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockPostCodeLib, PostCodeEnabled, 0, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockPostCodeLib, PostCodeDescriptionEnabled, 0, EFIAPI); |
33 changes: 33 additions & 0 deletions
33
MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.inf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## @file MockPostCodeLib.inf | ||
# Google Test mocks for PostCodeLib | ||
# | ||
# Copyright (c) Microsoft Corporation. | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 0x00010005 | ||
BASE_NAME = MockPostCodeLib | ||
FILE_GUID = 25BF192B-A519-4997-823A-AFEC2C953627 | ||
MODULE_TYPE = HOST_APPLICATION | ||
VERSION_STRING = 1.0 | ||
LIBRARY_CLASS = PostCodeLib | ||
|
||
# | ||
# The following information is for reference only and not required by the build tools. | ||
# | ||
# VALID_ARCHITECTURES = IA32 X64 | ||
# | ||
|
||
[Sources] | ||
MockPostCodeLib.cpp | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec | ||
|
||
[LibraryClasses] | ||
GoogleTestLib | ||
|
||
[BuildOptions] | ||
MSFT:*_*_*_CC_FLAGS = /EHsc |