TianoCore EDK2 master
Loading...
Searching...
No Matches
UnitTestFrameworkTypes.h File Reference

Go to the source code of this file.

Data Structures

struct  UNIT_TEST
 
struct  UNIT_TEST_LIST_ENTRY
 
struct  UNIT_TEST_SUITE
 
struct  UNIT_TEST_SUITE_LIST_ENTRY
 
struct  UNIT_TEST_FRAMEWORK
 
struct  UNIT_TEST_SAVE_TEST
 
struct  UNIT_TEST_SAVE_CONTEXT
 
struct  UNIT_TEST_SAVE_HEADER
 

Macros

#define UNIT_TEST_MAX_STRING_LENGTH   (512)
 
#define UNIT_TEST_FINGERPRINT_SIZE   (sizeof (UINT32))
 
#define FAILURETYPE_NOFAILURE   (0)
 
#define FAILURETYPE_OTHER   (1)
 
#define FAILURETYPE_ASSERTTRUE   (2)
 
#define FAILURETYPE_ASSERTFALSE   (3)
 
#define FAILURETYPE_ASSERTEQUAL   (4)
 
#define FAILURETYPE_ASSERTNOTEQUAL   (5)
 
#define FAILURETYPE_ASSERTNOTEFIERROR   (6)
 
#define FAILURETYPE_ASSERTSTATUSEQUAL   (7)
 
#define FAILURETYPE_ASSERTNOTNULL   (8)
 
#define FAILURETYPE_EXPECTASSERT   (9)
 

Typedefs

typedef UINT32 FAILURE_TYPE
 

Functions

VOID EFIAPI UnitTestLogInit (IN OUT UNIT_TEST *Test, IN UINT8 *Buffer OPTIONAL, IN UINTN BufferSize OPTIONAL)
 
UNIT_TEST_FRAMEWORK_HANDLE GetActiveFrameworkHandle (VOID)
 

Detailed Description

Provides the basic types and common elements of the unit test framework

Copyright (c) Microsoft Corporation.
Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UnitTestFrameworkTypes.h.

Macro Definition Documentation

◆ FAILURETYPE_ASSERTEQUAL

#define FAILURETYPE_ASSERTEQUAL   (4)

Definition at line 36 of file UnitTestFrameworkTypes.h.

◆ FAILURETYPE_ASSERTFALSE

#define FAILURETYPE_ASSERTFALSE   (3)

Definition at line 35 of file UnitTestFrameworkTypes.h.

◆ FAILURETYPE_ASSERTNOTEFIERROR

#define FAILURETYPE_ASSERTNOTEFIERROR   (6)

Definition at line 38 of file UnitTestFrameworkTypes.h.

◆ FAILURETYPE_ASSERTNOTEQUAL

#define FAILURETYPE_ASSERTNOTEQUAL   (5)

Definition at line 37 of file UnitTestFrameworkTypes.h.

◆ FAILURETYPE_ASSERTNOTNULL

#define FAILURETYPE_ASSERTNOTNULL   (8)

Definition at line 40 of file UnitTestFrameworkTypes.h.

◆ FAILURETYPE_ASSERTSTATUSEQUAL

#define FAILURETYPE_ASSERTSTATUSEQUAL   (7)

Definition at line 39 of file UnitTestFrameworkTypes.h.

◆ FAILURETYPE_ASSERTTRUE

#define FAILURETYPE_ASSERTTRUE   (2)

Definition at line 34 of file UnitTestFrameworkTypes.h.

◆ FAILURETYPE_EXPECTASSERT

#define FAILURETYPE_EXPECTASSERT   (9)

Definition at line 41 of file UnitTestFrameworkTypes.h.

◆ FAILURETYPE_NOFAILURE

#define FAILURETYPE_NOFAILURE   (0)

Definition at line 32 of file UnitTestFrameworkTypes.h.

◆ FAILURETYPE_OTHER

#define FAILURETYPE_OTHER   (1)

Definition at line 33 of file UnitTestFrameworkTypes.h.

◆ UNIT_TEST_FINGERPRINT_SIZE

#define UNIT_TEST_FINGERPRINT_SIZE   (sizeof (UINT32))

The size of a firngerprint used to save/resume execution of a unit test framework. This is the size of a CRC32 value which is 32-bit value.

Definition at line 25 of file UnitTestFrameworkTypes.h.

◆ UNIT_TEST_MAX_STRING_LENGTH

#define UNIT_TEST_MAX_STRING_LENGTH   (512)

The maximum length of a string stored in the unit test framework

Definition at line 18 of file UnitTestFrameworkTypes.h.

Typedef Documentation

◆ FAILURE_TYPE

typedef UINT32 FAILURE_TYPE

FAILURE_TYPE used to record the type of assert that was triggered by a unit test.

Definition at line 31 of file UnitTestFrameworkTypes.h.

Function Documentation

◆ GetActiveFrameworkHandle()

UNIT_TEST_FRAMEWORK_HANDLE GetActiveFrameworkHandle ( VOID  )

Internal helper function to return a handle to the currently executing framework. This function is generally used for communication within the UnitTest framework, but is defined here so that it can be consumed by the Assertion and Logging macros.

There should be no need to consume as a test writer, but it's there if you need it.

Return values
Handleto the currently executing test framework.

Definition at line 20 of file RunTests.c.

◆ UnitTestLogInit()

VOID EFIAPI UnitTestLogInit ( IN OUT UNIT_TEST Test,
IN UINT8 *Buffer  OPTIONAL,
IN UINTN BufferSize  OPTIONAL 
)

This function is responsible for initializing the log buffer for a single test. It can be used internally, but may also be consumed by the test framework to add pre-existing data to a log before it's used.

Parameters
[in,out]TestHandleA handle to the test being initialized.
[in]Buffer[Optional] A pointer to pre-existing log data that should be used to initialize the log. Should include a NULL terminator.
[in]BufferSize[Optional] The size of the pre-existing log data.

Definition at line 110 of file Log.c.