|
BOOLEAN EFIAPI | UnitTestAssertTrue (IN BOOLEAN Expression, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *Description) |
|
BOOLEAN EFIAPI | UnitTestAssertFalse (IN BOOLEAN Expression, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *Description) |
|
BOOLEAN EFIAPI | UnitTestAssertNotEfiError (IN EFI_STATUS Status, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *Description) |
|
BOOLEAN EFIAPI | UnitTestAssertEqual (IN UINT64 ValueA, IN UINT64 ValueB, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *DescriptionA, IN CONST CHAR8 *DescriptionB) |
|
BOOLEAN EFIAPI | UnitTestAssertMemEqual (IN VOID *BufferA, IN VOID *BufferB, IN UINTN Length, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *DescriptionA, IN CONST CHAR8 *DescriptionB) |
|
BOOLEAN EFIAPI | UnitTestAssertNotEqual (IN UINT64 ValueA, IN UINT64 ValueB, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *DescriptionA, IN CONST CHAR8 *DescriptionB) |
|
BOOLEAN EFIAPI | UnitTestAssertStatusEqual (IN EFI_STATUS Status, IN EFI_STATUS Expected, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *Description) |
|
BOOLEAN EFIAPI | UnitTestAssertNotNull (IN VOID *Pointer, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *PointerName) |
|
BOOLEAN EFIAPI | UnitTestExpectAssertFailure (IN UNIT_TEST_STATUS UnitTestStatus, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *FunctionCall, OUT UNIT_TEST_STATUS *ResultStatus OPTIONAL) |
|
Implement UnitTestLib assert services using cmocka services
Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file AssertCmocka.c.
BOOLEAN EFIAPI UnitTestAssertEqual |
( |
IN UINT64 |
ValueA, |
|
|
IN UINT64 |
ValueB, |
|
|
IN CONST CHAR8 * |
FunctionName, |
|
|
IN UINTN |
LineNumber, |
|
|
IN CONST CHAR8 * |
FileName, |
|
|
IN CONST CHAR8 * |
DescriptionA, |
|
|
IN CONST CHAR8 * |
DescriptionB |
|
) |
| |
If ValueA is equal ValueB, then TRUE is returned. If ValueA is not equal to ValueB, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, DescriptionA, and DescriptionB are recorded and FALSE is returned.
- Parameters
-
[in] | ValueA | 64-bit value. |
[in] | ValueB | 64-bit value. |
[in] | FunctionName | Null-terminated ASCII string of the function executing the assert macro. |
[in] | LineNumber | The source file line number of the assert macro. |
[in] | FileName | Null-terminated ASCII string of the filename executing the assert macro. |
[in] | DescriptionA | Null-terminated ASCII string that is a description of ValueA. |
[in] | DescriptionB | Null-terminated ASCII string that is a description of ValueB. |
- Return values
-
TRUE | ValueA is equal to ValueB. |
FALSE | ValueA is not equal to ValueB. |
Definition at line 152 of file AssertCmocka.c.
BOOLEAN EFIAPI UnitTestAssertFalse |
( |
IN BOOLEAN |
Expression, |
|
|
IN CONST CHAR8 * |
FunctionName, |
|
|
IN UINTN |
LineNumber, |
|
|
IN CONST CHAR8 * |
FileName, |
|
|
IN CONST CHAR8 * |
Description |
|
) |
| |
If Expression is FALSE, then TRUE is returned. If Expression is TRUE, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and Description are recorded and FALSE is returned.
- Parameters
-
[in] | Expression | The BOOLEAN result of the expression evaluation. |
[in] | FunctionName | Null-terminated ASCII string of the function executing the assert macro. |
[in] | LineNumber | The source file line number of the assert macro. |
[in] | FileName | Null-terminated ASCII string of the filename executing the assert macro. |
[in] | Description | Null-terminated ASCII string of the expression being evaluated. |
- Return values
-
TRUE | Expression is FALSE. |
FALSE | Expression is TRUE. |
Definition at line 77 of file AssertCmocka.c.
BOOLEAN EFIAPI UnitTestAssertMemEqual |
( |
IN VOID * |
BufferA, |
|
|
IN VOID * |
BufferB, |
|
|
IN UINTN |
Length, |
|
|
IN CONST CHAR8 * |
FunctionName, |
|
|
IN UINTN |
LineNumber, |
|
|
IN CONST CHAR8 * |
FileName, |
|
|
IN CONST CHAR8 * |
DescriptionA, |
|
|
IN CONST CHAR8 * |
DescriptionB |
|
) |
| |
If the contents of BufferA are identical to the contents of BufferB, then TRUE is returned. If the contents of BufferA are not identical to the contents of BufferB, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, DescriptionA, and DescriptionB are recorded and FALSE is returned.
- Parameters
-
[in] | BufferA | Pointer to a buffer for comparison. |
[in] | BufferB | Pointer to a buffer for comparison. |
[in] | Length | Number of bytes to compare in BufferA and BufferB. |
[in] | FunctionName | Null-terminated ASCII string of the function executing the assert macro. |
[in] | LineNumber | The source file line number of the assert macro. |
[in] | FileName | Null-terminated ASCII string of the filename executing the assert macro. |
[in] | DescriptionA | Null-terminated ASCII string that is a description of BufferA. |
[in] | DescriptionB | Null-terminated ASCII string that is a description of BufferB. |
- Return values
-
TRUE | The contents of BufferA are identical to the contents of BufferB. |
FALSE | The contents of BufferA are not identical to the contents of BufferB. |
Definition at line 197 of file AssertCmocka.c.
If Status is not an EFI_ERROR(), then TRUE is returned. If Status is an EFI_ERROR(), then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and Description are recorded and FALSE is returned.
- Parameters
-
[in] | Status | The EFI_STATUS value to evaluate. |
[in] | FunctionName | Null-terminated ASCII string of the function executing the assert macro. |
[in] | LineNumber | The source file line number of the assert macro. |
[in] | FileName | Null-terminated ASCII string of the filename executing the assert macro. |
[in] | Description | Null-terminated ASCII string of the status expression being evaluated. |
- Return values
-
TRUE | Status is not an EFI_ERROR(). |
FALSE | Status is an EFI_ERROR(). |
Definition at line 113 of file AssertCmocka.c.
BOOLEAN EFIAPI UnitTestAssertNotEqual |
( |
IN UINT64 |
ValueA, |
|
|
IN UINT64 |
ValueB, |
|
|
IN CONST CHAR8 * |
FunctionName, |
|
|
IN UINTN |
LineNumber, |
|
|
IN CONST CHAR8 * |
FileName, |
|
|
IN CONST CHAR8 * |
DescriptionA, |
|
|
IN CONST CHAR8 * |
DescriptionB |
|
) |
| |
If ValueA is not equal ValueB, then TRUE is returned. If ValueA is equal to ValueB, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, DescriptionA and DescriptionB are recorded and FALSE is returned.
- Parameters
-
[in] | ValueA | 64-bit value. |
[in] | ValueB | 64-bit value. |
[in] | FunctionName | Null-terminated ASCII string of the function executing the assert macro. |
[in] | LineNumber | The source file line number of the assert macro. |
[in] | FileName | Null-terminated ASCII string of the filename executing the assert macro. |
[in] | DescriptionA | Null-terminated ASCII string that is a description of ValueA. |
[in] | DescriptionB | Null-terminated ASCII string that is a description of ValueB. |
- Return values
-
TRUE | ValueA is not equal to ValueB. |
FALSE | ValueA is equal to ValueB. |
Definition at line 242 of file AssertCmocka.c.
BOOLEAN EFIAPI UnitTestAssertNotNull |
( |
IN VOID * |
Pointer, |
|
|
IN CONST CHAR8 * |
FunctionName, |
|
|
IN UINTN |
LineNumber, |
|
|
IN CONST CHAR8 * |
FileName, |
|
|
IN CONST CHAR8 * |
PointerName |
|
) |
| |
If Pointer is not equal to NULL, then TRUE is returned. If Pointer is equal to NULL, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and PointerName are recorded and FALSE is returned.
- Parameters
-
[in] | Pointer | Pointer value to be checked against NULL. |
[in] | Expected | The expected EFI_STATUS return value from a function under test. |
[in] | FunctionName | Null-terminated ASCII string of the function executing the assert macro. |
[in] | LineNumber | The source file line number of the assert macro. |
[in] | FileName | Null-terminated ASCII string of the filename executing the assert macro. |
[in] | PointerName | Null-terminated ASCII string that is a description of Pointer. |
- Return values
-
TRUE | Pointer is not equal to NULL. |
FALSE | Pointer is equal to NULL. |
Definition at line 321 of file AssertCmocka.c.
If Status is equal to Expected, then TRUE is returned. If Status is not equal to Expected, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and Description are recorded and FALSE is returned.
- Parameters
-
[in] | Status | EFI_STATUS value returned from an API under test. |
[in] | Expected | The expected EFI_STATUS return value from an API under test. |
[in] | FunctionName | Null-terminated ASCII string of the function executing the assert macro. |
[in] | LineNumber | The source file line number of the assert macro. |
[in] | FileName | Null-terminated ASCII string of the filename executing the assert macro. |
[in] | Description | Null-terminated ASCII string that is a description of Status. |
- Return values
-
TRUE | Status is equal to Expected. |
FALSE | Status is not equal to Expected. |
Definition at line 282 of file AssertCmocka.c.
BOOLEAN EFIAPI UnitTestAssertTrue |
( |
IN BOOLEAN |
Expression, |
|
|
IN CONST CHAR8 * |
FunctionName, |
|
|
IN UINTN |
LineNumber, |
|
|
IN CONST CHAR8 * |
FileName, |
|
|
IN CONST CHAR8 * |
Description |
|
) |
| |
If Expression is TRUE, then TRUE is returned. If Expression is FALSE, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and Description are recorded and FALSE is returned.
- Parameters
-
[in] | Expression | The BOOLEAN result of the expression evaluation. |
[in] | FunctionName | Null-terminated ASCII string of the function executing the assert macro. |
[in] | LineNumber | The source file line number of the assert macro. |
[in] | FileName | Null-terminated ASCII string of the filename executing the assert macro. |
[in] | Description | Null-terminated ASCII string of the expression being evaluated. |
- Return values
-
TRUE | Expression is TRUE. |
FALSE | Expression is FALSE. |
Definition at line 41 of file AssertCmocka.c.