TEST(UnityCommandOptions, DefaultOptions) { UnityGetCommandLineOptions(1, noOptions); TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); }
TEST(UnityFixture, ReallocSameIsUnchanged) { void* m1 = malloc(10); void* m2 = realloc(m1, 10); TEST_ASSERT_POINTERS_EQUAL(m1, m2); free(m2); }
TEST(LightSchedulerInitAndCleanup, CreateStartsOneMinuteAlarm) { LightScheduler_Create(); TEST_ASSERT_POINTERS_EQUAL((void *)LightScheduler_Wakeup, (void *)FakeTimeSource_GetAlarmCallback()); TEST_ASSERT_EQUAL(60, FakeTimeSource_GetAlarmPeriod()); LightScheduler_Destroy(); }
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); }
TEST(vector_operations, get_pointer_of_indexvalue_3){ _FLOAT_ *ptr; _FLOAT_ *compare_ptr; compare_ptr = &(vect->v[2]); ptr = Vect_pointer_to_index(vect, 3); TEST_ASSERT_POINTERS_EQUAL(compare_ptr, ptr); }
TEST(UnityFixture, ForceMallocFail) { void* m; void* mfails; UnityMalloc_MakeMallocFailAfterCount(1); m = malloc(10); CHECK(m); mfails = malloc(10); TEST_ASSERT_POINTERS_EQUAL(0, mfails); free(m); }
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(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) { void* m1 = malloc(10); void* m2 = realloc(m1, 0); TEST_ASSERT_POINTERS_EQUAL(0, m2); }
TEST(LightSchedulerInitAndCleanup, DestroyCancelsOneMinuteAlarm) { LightScheduler_Create(); LightScheduler_Destroy(); TEST_ASSERT_POINTERS_EQUAL(NULL, (void *)FakeTimeSource_GetAlarmCallback()); }