Kernel improvements (#485)
* **New Features** * Added public accessors for querying module/device start and ready state. * **Refactor** * Internal state moved to opaque internal objects; module/device/driver initializers now explicitly initialize internal pointers. * Lifecycle handling updated to construct/destruct internal state and use accessors. * **Tests** * Tests updated to use public accessors and explicit construct/destruct lifecycle calls. * **Chores** * Test build/include paths and small metadata updated.
This commit is contained in:
committed by
GitHub
parent
1757af859c
commit
79e43b093a
@@ -0,0 +1,30 @@
|
||||
#include "doctest.h"
|
||||
#include <tactility/delay.h>
|
||||
#include <tactility/time.h>
|
||||
|
||||
TEST_CASE("delay ticks should be accurate within 1 tick") {
|
||||
auto start_time = get_ticks();
|
||||
delay_ticks(100);
|
||||
auto end_time = get_ticks();
|
||||
auto difference = end_time - start_time;
|
||||
CHECK_EQ(difference >= 100, true);
|
||||
CHECK_EQ(difference <= 101, true);
|
||||
}
|
||||
|
||||
TEST_CASE("delay millis should be accurate within 1 tick") {
|
||||
auto start_time = get_millis();
|
||||
delay_millis(100);
|
||||
auto end_time = get_millis();
|
||||
auto difference = end_time - start_time;
|
||||
CHECK_EQ(difference >= 100, true);
|
||||
CHECK_EQ(difference <= 101, true);
|
||||
}
|
||||
|
||||
TEST_CASE("microsecond time should be accurate within 1 tick") {
|
||||
auto start_time = get_micros_since_boot();
|
||||
delay_millis(100);
|
||||
auto end_time = get_micros_since_boot();
|
||||
auto difference = (end_time - start_time) / 1000;
|
||||
CHECK_EQ(difference >= 99, true);
|
||||
CHECK_EQ(difference <= 101, true);
|
||||
}
|
||||
Reference in New Issue
Block a user