24#define UNIT_TEST_APP_NAME "UefiSortLib Unit Tests"
25#define UNIT_TEST_APP_VERSION "1.0"
27#define TEST_ARRAY_SIZE_9 9
47 if (*(UINT32 *)Right > *(UINT32 *)Left) {
49 }
else if (*(UINT32 *)Right < *(UINT32 *)Left) {
79 UINT32 TestBuffer[TEST_ARRAY_SIZE_9];
80 UINT32 TestResult[TEST_ARRAY_SIZE_9];
82 TestCount = TEST_ARRAY_SIZE_9;
83 for (Index = 0; Index < TEST_ARRAY_SIZE_9; Index++) {
84 TestBuffer[Index] = Index + 1;
85 TestResult[Index] = TEST_ARRAY_SIZE_9 - Index;
91 return UNIT_TEST_PASSED;
116 CONST CHAR16 *TestBuffer[] = { L
"abcdefg" };
121 return UNIT_TEST_PASSED;
140 UNIT_TEST_FRAMEWORK_HANDLE Framework;
141 UNIT_TEST_SUITE_HANDLE SortTests;
145 DEBUG ((DEBUG_INFO,
"%a v%a\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION));
150 Status =
InitUnitTestFramework (&Framework, UNIT_TEST_APP_NAME, gEfiCallerBaseName, UNIT_TEST_APP_VERSION);
151 if (EFI_ERROR (Status)) {
152 DEBUG ((DEBUG_ERROR,
"Failed in InitUnitTestFramework. Status = %r\n", Status));
160 if (EFI_ERROR (Status)) {
161 DEBUG ((DEBUG_ERROR,
"Failed in CreateUnitTestSuite for UefiSortLib API Tests\n"));
162 Status = EFI_OUT_OF_RESOURCES;
188#define UefiSortLibUnitTestMain main
#define DEBUG(Expression)
VOID EFIAPI PerformQuickSort(IN OUT VOID *BufferToSort, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN SORT_COMPARE CompareFunction)
INTN EFIAPI StringCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
#define UefiSortLibUnitTestMain
INTN EFIAPI TestCompareFunction(IN CONST VOID *Left, IN CONST VOID *Right)
UNIT_TEST_STATUS EFIAPI CompareSameBufferShouldSucceed(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI SortUINT32ArrayShouldSucceed(IN UNIT_TEST_CONTEXT Context)
STATIC EFI_STATUS EFIAPI UnitTestingEntry(VOID)
EFI_STATUS EFIAPI RunAllTestSuites(IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle)
#define UT_ASSERT_MEM_EQUAL(BufferA, BufferB, Length)
#define UT_ASSERT_TRUE(Expression)
EFI_STATUS EFIAPI CreateUnitTestSuite(OUT UNIT_TEST_SUITE_HANDLE *SuiteHandle, IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, IN CHAR8 *Title, IN CHAR8 *Name, IN UNIT_TEST_SUITE_SETUP Setup OPTIONAL, IN UNIT_TEST_SUITE_TEARDOWN Teardown OPTIONAL)
EFI_STATUS EFIAPI FreeUnitTestFramework(IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle)
EFI_STATUS EFIAPI AddTestCase(IN UNIT_TEST_SUITE_HANDLE SuiteHandle, IN CHAR8 *Description, IN CHAR8 *Name, IN UNIT_TEST_FUNCTION Function, IN UNIT_TEST_PREREQUISITE Prerequisite OPTIONAL, IN UNIT_TEST_CLEANUP CleanUp OPTIONAL, IN UNIT_TEST_CONTEXT Context OPTIONAL)
EFI_STATUS EFIAPI InitUnitTestFramework(OUT UNIT_TEST_FRAMEWORK_HANDLE *FrameworkHandle, IN CHAR8 *Title, IN CHAR8 *ShortTitle, IN CHAR8 *VersionString)