mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-30 00:54:06 +02:00
MdeModulePkg: Apply uncrustify formatting to relevant files.
Apply uncrustify formatting to GoogleTest cpp files and respective header file. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Vivian Nowka-Keane <vnowkakeane@linux.microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
parent
41c622523d
commit
504953ef97
@ -20,9 +20,9 @@ CompareUint32 (
|
|||||||
IN CONST VOID *Right
|
IN CONST VOID *Right
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (*(UINT32*)Right > *(UINT32*)Left) {
|
if (*(UINT32 *)Right > *(UINT32 *)Left) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (*(UINT32*)Right < *(UINT32*)Left) {
|
} else if (*(UINT32 *)Right < *(UINT32 *)Left) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,31 +31,36 @@ CompareUint32 (
|
|||||||
|
|
||||||
// Test PerformQuickSort() API from UefiSortLib to verify a UINT32 array
|
// Test PerformQuickSort() API from UefiSortLib to verify a UINT32 array
|
||||||
// with 9 elements in ascending order is sorted into descending order.
|
// with 9 elements in ascending order is sorted into descending order.
|
||||||
TEST(PerformQuickSortTest, SortUint32AscendingArray_Size9) {
|
TEST (PerformQuickSortTest, SortUint32AscendingArray_Size9) {
|
||||||
CONST UINT32 ArraySize = 9;
|
CONST UINT32 ArraySize = 9;
|
||||||
UINT32 BuffActual[ArraySize];
|
UINT32 BuffActual[ArraySize];
|
||||||
UINT32 BuffExpected[ArraySize];
|
UINT32 BuffExpected[ArraySize];
|
||||||
|
|
||||||
for (UINT32 Index = 0; Index < ArraySize; Index++) {
|
for (UINT32 Index = 0; Index < ArraySize; Index++) {
|
||||||
BuffActual[Index] = Index + 1;
|
BuffActual[Index] = Index + 1;
|
||||||
BuffExpected[Index] = ArraySize - Index;
|
BuffExpected[Index] = ArraySize - Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformQuickSort (BuffActual, (UINTN)ArraySize, sizeof(UINT32), (SORT_COMPARE)CompareUint32);
|
PerformQuickSort (BuffActual, (UINTN)ArraySize, sizeof (UINT32), (SORT_COMPARE)CompareUint32);
|
||||||
EXPECT_THAT(BuffActual, ElementsAreArray(BuffExpected, ArraySize));
|
EXPECT_THAT (BuffActual, ElementsAreArray (BuffExpected, ArraySize));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test StringCompare() API from UefiSortLib to verify the comparison
|
// Test StringCompare() API from UefiSortLib to verify the comparison
|
||||||
// succeeds when the same buffer is compared with itself.
|
// succeeds when the same buffer is compared with itself.
|
||||||
TEST(StringCompareTest, CompareSameBuffer) {
|
TEST (StringCompareTest, CompareSameBuffer) {
|
||||||
INTN RetVal;
|
INTN RetVal;
|
||||||
CONST CHAR16 *Buffer = (CHAR16*)L"abcdefg";
|
CONST CHAR16 *Buffer = (CHAR16 *)L"abcdefg";
|
||||||
|
|
||||||
RetVal = StringCompare (&Buffer, &Buffer);
|
RetVal = StringCompare (&Buffer, &Buffer);
|
||||||
EXPECT_EQ(RetVal, 0);
|
EXPECT_EQ (RetVal, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int
|
||||||
testing::InitGoogleTest(&argc, argv);
|
main (
|
||||||
return RUN_ALL_TESTS();
|
int argc,
|
||||||
|
char *argv[]
|
||||||
|
)
|
||||||
|
{
|
||||||
|
testing::InitGoogleTest (&argc, argv);
|
||||||
|
return RUN_ALL_TESTS ();
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#include <Library/GoogleTestLib.h>
|
#include <Library/GoogleTestLib.h>
|
||||||
#include <Library/FunctionMockLib.h>
|
#include <Library/FunctionMockLib.h>
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
#include <Library/PciHostBridgeLib.h>
|
#include <Library/PciHostBridgeLib.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MockPciHostBridgeLib {
|
struct MockPciHostBridgeLib {
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <GoogleTest/Library/MockPciHostBridgeLib.h>
|
#include <GoogleTest/Library/MockPciHostBridgeLib.h>
|
||||||
|
|
||||||
MOCK_INTERFACE_DEFINITION(MockPciHostBridgeLib);
|
MOCK_INTERFACE_DEFINITION (MockPciHostBridgeLib);
|
||||||
|
|
||||||
MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeGetRootBridges, 1, EFIAPI);
|
MOCK_FUNCTION_DEFINITION (MockPciHostBridgeLib, PciHostBridgeGetRootBridges, 1, EFIAPI);
|
||||||
MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeFreeRootBridges, 2, EFIAPI);
|
MOCK_FUNCTION_DEFINITION (MockPciHostBridgeLib, PciHostBridgeFreeRootBridges, 2, EFIAPI);
|
||||||
MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeResourceConflict, 2, EFIAPI);
|
MOCK_FUNCTION_DEFINITION (MockPciHostBridgeLib, PciHostBridgeResourceConflict, 2, EFIAPI);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user