16#define UNIT_TEST_NAME "Sample Unit Test"
17#define UNIT_TEST_VERSION "0.1"
23VOID *mSampleGlobalTestPointer =
NULL;
53 return UNIT_TEST_PASSED;
84 mSampleGlobalTestPointer =
NULL;
119 return UNIT_TEST_PASSED;
149 return UNIT_TEST_PASSED;
177 UT_LOG_WARNING (
"About to change a global pointer! Current value is 0x%X\n", mSampleGlobalTestPointer);
179 mSampleGlobalTestPointer = (VOID *)-1;
181 return UNIT_TEST_PASSED;
248 return UNIT_TEST_PASSED;
285 return UNIT_TEST_PASSED;
322 return UNIT_TEST_PASSED;
355 Length =
sizeof (
"Hello");
358 return UNIT_TEST_PASSED;
395 return UNIT_TEST_PASSED;
429 return UNIT_TEST_PASSED;
458 return UNIT_TEST_PASSED;
489 return UNIT_TEST_PASSED;
525 return UNIT_TEST_PASSED;
554 return UNIT_TEST_PASSED;
583 return UNIT_TEST_PASSED;
612 return UNIT_TEST_PASSED;
641 return UNIT_TEST_PASSED;
659 UNIT_TEST_FRAMEWORK_HANDLE Framework;
660 UNIT_TEST_SUITE_HANDLE SimpleMathTests;
661 UNIT_TEST_SUITE_HANDLE GlobalVarTests;
662 UNIT_TEST_SUITE_HANDLE MacroTestsAssertsEnabled;
663 UNIT_TEST_SUITE_HANDLE MacroTestsAssertsDisabled;
667 DEBUG ((DEBUG_INFO,
"%a v%a\n", UNIT_TEST_NAME, UNIT_TEST_VERSION));
673 if (EFI_ERROR (Status)) {
674 DEBUG ((DEBUG_ERROR,
"Failed in InitUnitTestFramework. Status = %r\n", Status));
682 if (EFI_ERROR (Status)) {
683 DEBUG ((DEBUG_ERROR,
"Failed in CreateUnitTestSuite for SimpleMathTests\n"));
684 Status = EFI_OUT_OF_RESOURCES;
694 if (EFI_ERROR (Status)) {
695 DEBUG ((DEBUG_ERROR,
"Failed in CreateUnitTestSuite for GlobalVarTests\n"));
696 Status = EFI_OUT_OF_RESOURCES;
707 if (EFI_ERROR (Status)) {
708 DEBUG ((DEBUG_ERROR,
"Failed in CreateUnitTestSuite for MacroTestsAssertsEnabled\n"));
709 Status = EFI_OUT_OF_RESOURCES;
732 if (EFI_ERROR (Status)) {
733 DEBUG ((DEBUG_ERROR,
"Failed in CreateUnitTestSuite for MacroTestsAssertsDisabled\n"));
734 Status = EFI_OUT_OF_RESOURCES;
UINT8 EFIAPI DecimalToBcd8(IN UINT8 Value)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
int main()
=== TEST ENGINE ================================================================================
#define DEBUG(Expression)
#define PcdGet8(TokenName)
#define PatchPcdSet8(TokenName, Value)
VOID * EFI_PEI_FILE_HANDLE
UNIT_TEST_STATUS EFIAPI OnePlusOneShouldEqualTwo(IN UNIT_TEST_CONTEXT Context)
VOID EFIAPI ClearThePointer(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtLogInfo(IN UNIT_TEST_CONTEXT Context)
EFI_STATUS EFIAPI UefiTestMain(VOID)
UNIT_TEST_STATUS EFIAPI MacroUtAssertNotEfiError(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI GlobalPointerShouldBeChangeable(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtAssertTrue(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtAssertEqual(IN UNIT_TEST_CONTEXT Context)
VOID EFIAPI TestSuiteDisableAsserts(VOID)
UNIT_TEST_STATUS EFIAPI GlobalBooleanShouldBeChangeable(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtLogError(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtAssertNotEqual(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtAssertNotNull(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtAssertStatusEqual(IN UNIT_TEST_CONTEXT Context)
VOID EFIAPI TestSuiteEnableAsserts(VOID)
EFI_STATUS EFIAPI DxeEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
UNIT_TEST_STATUS EFIAPI MacroUtAssertMemEqual(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtExpectAssertFailure(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtLogVerbose(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtLogWarning(IN UNIT_TEST_CONTEXT Context)
EFI_STATUS EFIAPI PeiEntryPoint(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
UNIT_TEST_STATUS EFIAPI MakeSureThatPointerIsNull(IN UNIT_TEST_CONTEXT Context)
UNIT_TEST_STATUS EFIAPI MacroUtAssertFalse(IN UNIT_TEST_CONTEXT Context)
BOOLEAN mSampleGlobalTestBoolean
EFI_STATUS EFIAPI RunAllTestSuites(IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle)
#define UT_ASSERT_NOT_NULL(Pointer)
#define UT_LOG_ERROR(Format,...)
#define UT_ASSERT_NOT_EQUAL(ValueA, ValueB)
#define UT_EXPECT_ASSERT_FAILURE(FunctionCall, Status)
#define UT_ASSERT_MEM_EQUAL(BufferA, BufferB, Length)
#define UT_ASSERT_TRUE(Expression)
#define UT_ASSERT_EQUAL(ValueA, ValueB)
#define UT_ASSERT_STATUS_EQUAL(Status, Expected)
#define UT_LOG_INFO(Format,...)
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)
#define UT_LOG_VERBOSE(Format,...)
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)
#define UT_LOG_WARNING(Format,...)
EFI_STATUS EFIAPI InitUnitTestFramework(OUT UNIT_TEST_FRAMEWORK_HANDLE *FrameworkHandle, IN CHAR8 *Title, IN CHAR8 *ShortTitle, IN CHAR8 *VersionString)
#define UT_ASSERT_FALSE(Expression)
#define UT_ASSERT_NOT_EFI_ERROR(Status)