void setup() { db_time = 20; UT_PTR_SET(is_pressed,&mock_is_pressed); // UT_PTR_SET(button_is_pressed,&mock_button_is_pressed); UT_PTR_SET(_delay,&mock_delay); UT_PTR_SET(cmillis,&mock_cmillis); }
TEST(UTestPlatformsTest_PlatformSpecificRunTestInASeperateProcess, CallToWaitPidWhileDebuggingInSeparateProcessWorks) { UT_PTR_SET(original_waitpid, PlatformSpecificWaitPid); UT_PTR_SET(PlatformSpecificWaitPid, waitpid_while_debugging_stub); fixture.registry_->setRunTestsInSeperateProcess(); fixture.runAllTests(); fixture.assertPrintContains("OK (1 tests, 0 ran, 0 checks, 0 ignored, 0 filtered out"); }
JUnitTestOutputTestRunner(TestResult result) : result_(result), currentGroupName_(0), currentTest_(0), firstTestInGroup_(true), timeTheTestTakes_(0), testFailure_(0) { millisTime = 0; theTime = "1978-10-03T00:00:00"; UT_PTR_SET(GetPlatformSpecificTimeInMillis, MockGetPlatformSpecificTimeInMillis); UT_PTR_SET(GetPlatformSpecificTimeString, MockGetPlatformSpecificTimeString); }
void setup() { Stub_SetupDefault(); setup_default_coefficients(); measure_result = HP03S_ERROR; UT_PTR_SET(HP03S_ReadSensorParameter, Mock_ReadSensorParameter); UT_PTR_SET(HP03S_ReadSensorCoefficient, Mock_ReadSensorCoefficient); UT_PTR_SET(HP03S_ReadPressure, Mock_ReadPressure); UT_PTR_SET(HP03S_ReadTemperature, Mock_ReadTemperature); }
TEST(UnityFixture, PointerSetting) { TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); UT_PTR_SET(pointer1, &int1); UT_PTR_SET(pointer2, &int2); UT_PTR_SET(pointer3, &int3); TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); UT_PTR_SET(pointer1, &int4); UnityPointer_UndoAllSets(); TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); }
TEST(UTestPlatformsTest_PlatformSpecificRunTestInASeperateProcess, CallToWaitPidFailedInSeparateProcessWorks) { UT_PTR_SET(PlatformSpecificWaitPid, waitpid_failed_stub); fixture.registry_->setRunTestsInSeperateProcess(); fixture.runAllTests(); fixture.assertPrintContains("Call to waitpid() failed"); }
TEST(LeakDetection, PointerSettingMax) { #ifndef USING_OUTPUT_SPY TEST_IGNORE(); #else int i; for (i = 0; i < 50; i++) UT_PTR_SET(pointer1, &int1); UnityOutputCharSpy_Enable(1); EXPECT_ABORT_BEGIN UT_PTR_SET(pointer1, &int1); EXPECT_ABORT_END UnityOutputCharSpy_Enable(0); Unity.CurrentTestFailed = 0; CHECK(strstr(UnityOutputCharSpy_Get(), "Too many pointers set")); #endif }
TEST(UtestShell, RunInSeparateProcessTest) { UT_PTR_SET(PlatformSpecificRunTestInASeperateProcess, StubPlatformSpecificRunTestInASeperateProcess); fixture.registry_->setRunTestsInSeperateProcess(); fixture.runAllTests(); fixture.assertPrintContains("Failed in separate process"); }
TEST(UnityFixture, PointerSet) { char c1; char c2; char newC1; char newC2; p1 = &c1; p2 = &c2; UnityPointer_Init(); UT_PTR_SET(p1, &newC1); UT_PTR_SET(p2, &newC2); TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); UnityPointer_UndoAllSets(); TEST_ASSERT_POINTERS_EQUAL(&c1, p1); TEST_ASSERT_POINTERS_EQUAL(&c2, p2); }
void setup() { buffer = new SimpleString(); UT_PTR_SET(PrintFormated, &output_method); }
void setup() { UT_PTR_SET(pinMode, &mock_pinMode); UT_PTR_SET(digitalWrite, &mock_digitalWrite); }