TianoCore EDK2 master
|
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UnitTestLib.h>
#include <Library/SortLib.h>
Go to the source code of this file.
Macros | |
#define | UNIT_TEST_APP_NAME "UefiSortLib Unit Tests" |
#define | UNIT_TEST_APP_VERSION "1.0" |
#define | TEST_ARRAY_SIZE_9 9 |
#define | UefiSortLibUnitTestMain main |
Functions | |
INTN EFIAPI | TestCompareFunction (IN CONST VOID *Left, IN CONST VOID *Right) |
UNIT_TEST_STATUS EFIAPI | SortUINT32ArrayShouldSucceed (IN UNIT_TEST_CONTEXT Context) |
UNIT_TEST_STATUS EFIAPI | CompareSameBufferShouldSucceed (IN UNIT_TEST_CONTEXT Context) |
STATIC EFI_STATUS EFIAPI | UnitTestingEntry (VOID) |
INT32 | UefiSortLibUnitTestMain (IN INT32 Argc, IN CHAR8 *Argv[]) |
Unit tests of the UefiSortLib
Copyright (C) Huawei Technologies Co., Ltd. All rights reserved SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UefiSortLibUnitTest.c.
#define TEST_ARRAY_SIZE_9 9 |
Definition at line 27 of file UefiSortLibUnitTest.c.
#define UefiSortLibUnitTestMain main |
Avoid ECC error for function name that starts with lower case letter
Definition at line 188 of file UefiSortLibUnitTest.c.
#define UNIT_TEST_APP_NAME "UefiSortLib Unit Tests" |
Definition at line 24 of file UefiSortLibUnitTest.c.
#define UNIT_TEST_APP_VERSION "1.0" |
Definition at line 25 of file UefiSortLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI CompareSameBufferShouldSucceed | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test for StringCompare () API of the UefiSortLib.
[in] | Context | [Optional] An optional parameter that enables: 1) test-case reuse with varied parameters and 2) test-case re-entry for Target tests that need a reboot. This parameter is a VOID* and it is the responsibility of the test author to ensure that the contents are well understood by all test cases that may consume it. |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 111 of file UefiSortLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI SortUINT32ArrayShouldSucceed | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test for PerformQuickSort () API of the UefiSortLib.
[in] | Context | [Optional] An optional parameter that enables: 1) test-case reuse with varied parameters and 2) test-case re-entry for Target tests that need a reboot. This parameter is a VOID* and it is the responsibility of the test author to ensure that the contents are well understood by all test cases that may consume it. |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 73 of file UefiSortLibUnitTest.c.
The function is called by PerformQuickSort to compare int values.
[in] | Left | The pointer to first buffer. |
[in] | Right | The pointer to second buffer. |
0 | Buffer1 equal to Buffer2. |
Definition at line 42 of file UefiSortLibUnitTest.c.
Standard POSIX C entry point for host based unit test execution.
[in] | Argc | Number of arguments |
[in] | Argv | Array of pointers to arguments |
0 | Success |
other | Error |
Definition at line 200 of file UefiSortLibUnitTest.c.
STATIC EFI_STATUS EFIAPI UnitTestingEntry | ( | VOID | ) |
Initialze the unit test framework, suite, and unit tests for the UefiSortLib and run the UefiSortLib unit test.
EFI_SUCCESS | All test cases were dispatched. |
EFI_OUT_OF_RESOURCES | There are not enough resources available to initialize the unit tests. |
Definition at line 135 of file UefiSortLibUnitTest.c.