18#define UNIT_TEST_NAME "Sample Unit Test Expect Fail"
19#define UNIT_TEST_VERSION "0.1"
25VOID *mSampleGlobalTestPointer =
NULL;
55 return UNIT_TEST_PASSED;
86 mSampleGlobalTestPointer =
NULL;
121 return UNIT_TEST_PASSED;
151 return UNIT_TEST_PASSED;
179 UT_LOG_WARNING (
"About to change a global pointer! Current value is 0x%X\n", mSampleGlobalTestPointer);
181 mSampleGlobalTestPointer = (VOID *)-1;
183 return UNIT_TEST_PASSED;
250 return UNIT_TEST_PASSED;
287 return UNIT_TEST_PASSED;
324 return UNIT_TEST_PASSED;
357 Length =
sizeof (
"Hello1");
360 return UNIT_TEST_PASSED;
397 return UNIT_TEST_PASSED;
431 return UNIT_TEST_PASSED;
460 return UNIT_TEST_PASSED;
489 return UNIT_TEST_PASSED;
516 if ((
PcdGet8 (PcdDebugPropertyMask) & BIT0) == 0x00) {
518 return UNIT_TEST_PASSED;
533 return UNIT_TEST_PASSED;
560 if ((
PcdGet8 (PcdDebugPropertyMask) & BIT0) == 0x00) {
562 return UNIT_TEST_PASSED;
572 return UNIT_TEST_PASSED;
603 return UNIT_TEST_PASSED;
634 return UNIT_TEST_PASSED;
665 return UNIT_TEST_PASSED;
696 return UNIT_TEST_PASSED;
714 UNIT_TEST_FRAMEWORK_HANDLE Framework;
715 UNIT_TEST_SUITE_HANDLE SimpleMathTests;
716 UNIT_TEST_SUITE_HANDLE GlobalVarTests;
717 UNIT_TEST_SUITE_HANDLE MacroTestsAssertsEnabled;
718 UNIT_TEST_SUITE_HANDLE MacroTestsAssertsDisabled;
722 DEBUG ((DEBUG_INFO,
"%a v%a\n", UNIT_TEST_NAME, UNIT_TEST_VERSION));
728 if (EFI_ERROR (Status)) {
729 DEBUG ((DEBUG_ERROR,
"Failed in InitUnitTestFramework. Status = %r\n", Status));
737 if (EFI_ERROR (Status)) {
738 DEBUG ((DEBUG_ERROR,
"Failed in CreateUnitTestSuite for SimpleMathTests\n"));
739 Status = EFI_OUT_OF_RESOURCES;
749 if (EFI_ERROR (Status)) {
750 DEBUG ((DEBUG_ERROR,
"Failed in CreateUnitTestSuite for GlobalVarTests\n"));
751 Status = EFI_OUT_OF_RESOURCES;
762 if (EFI_ERROR (Status)) {
763 DEBUG ((DEBUG_ERROR,
"Failed in CreateUnitTestSuite for MacroTestsAssertsEnabled\n"));
764 Status = EFI_OUT_OF_RESOURCES;
788 if (EFI_ERROR (Status)) {
789 DEBUG ((DEBUG_ERROR,
"Failed in CreateUnitTestSuite for MacroTestsAssertsDisabled\n"));
790 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 GenerateUnexpectedAssert(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)