mirror of https://github.com/ARMmbed/mbed-os.git
tests-mbed_drivers-rtc: Add one second tolerance in functional tests.
Currently test assumes that 1 sec is long enough to set RTC time and read same time which has been set. In some cases extra time for synchronisation between clock domains is needed and after setting/reading operations the read value might be different than one which has been set (+1 sec). Additionally in some cases when lp ticker is based on RTC, the RTC implementation may use mechanism to trace elapsed seconds without modifying RTC registers. In such case it is possible that second will change immediately after setting time. Add 1 sec tolerance (min possible) for such checks.pull/6852/head
parent
8bddb6b305
commit
2ccc11f243
|
@ -144,7 +144,7 @@ void test_attach_RTC_stub_funtions()
|
|||
TEST_ASSERT_EQUAL(false, rtc_init_called);
|
||||
|
||||
/* Check if time has been successfully set and retrieved. */
|
||||
TEST_ASSERT_EQUAL(CUSTOM_TIME_1, seconds);
|
||||
TEST_ASSERT_UINT32_WITHIN(RTC_DELTA, CUSTOM_TIME_1, seconds);
|
||||
}
|
||||
|
||||
/* This test verifies if attach_rtc provides availability to
|
||||
|
@ -183,7 +183,7 @@ void test_attach_RTC_org_funtions()
|
|||
TEST_ASSERT_EQUAL(false, rtc_init_called);
|
||||
|
||||
/* Check if time has been successfully set and retrieved. */
|
||||
TEST_ASSERT_EQUAL(CUSTOM_TIME_1, seconds);
|
||||
TEST_ASSERT_UINT32_WITHIN(RTC_DELTA, CUSTOM_TIME_1, seconds);
|
||||
}
|
||||
|
||||
/* This test verifies if time() function returns
|
||||
|
@ -430,7 +430,7 @@ void test_functional_set()
|
|||
set_time(timeValue);
|
||||
|
||||
/* Get current time and verify that new value has been set. */
|
||||
TEST_ASSERT_EQUAL(timeValue, time(NULL));
|
||||
TEST_ASSERT_UINT32_WITHIN(1, timeValue, time(NULL));
|
||||
}
|
||||
|
||||
/* This test verifies if RTC counts seconds.
|
||||
|
|
Loading…
Reference in New Issue