mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #4253 from cgundogan/pr/tests/vtimer_xtimer
tests: some more vtimer -> xtimer conversions
This commit is contained in:
commit
0d9cc5dad1
@ -28,7 +28,7 @@ QUIET ?= 1
|
|||||||
CXXEXFLAGS += -std=c++11
|
CXXEXFLAGS += -std=c++11
|
||||||
|
|
||||||
USEMODULE += cpp11-compat
|
USEMODULE += cpp11-compat
|
||||||
USEMODULE += vtimer
|
USEMODULE += xtimer
|
||||||
USEMODULE += timex
|
USEMODULE += timex
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
@ -98,9 +98,9 @@ int main() {
|
|||||||
condition_variable cv;
|
condition_variable cv;
|
||||||
timex_t before, after;
|
timex_t before, after;
|
||||||
unique_lock<mutex> lk(m);
|
unique_lock<mutex> lk(m);
|
||||||
vtimer_now(&before);
|
xtimer_now_timex(&before);
|
||||||
cv.wait_for(lk, chrono::seconds(timeout));
|
cv.wait_for(lk, chrono::seconds(timeout));
|
||||||
vtimer_now(&after);
|
xtimer_now_timex(&after);
|
||||||
auto diff = timex_sub(after, before);
|
auto diff = timex_sub(after, before);
|
||||||
assert(diff.seconds >= timeout);
|
assert(diff.seconds >= timeout);
|
||||||
}
|
}
|
||||||
@ -114,10 +114,10 @@ int main() {
|
|||||||
condition_variable cv;
|
condition_variable cv;
|
||||||
timex_t before, after;
|
timex_t before, after;
|
||||||
unique_lock<mutex> lk(m);
|
unique_lock<mutex> lk(m);
|
||||||
vtimer_now(&before);
|
xtimer_now_timex(&before);
|
||||||
auto time = riot::now() += chrono::seconds(timeout);
|
auto time = riot::now() += chrono::seconds(timeout);
|
||||||
cv.wait_until(lk, time);
|
cv.wait_until(lk, time);
|
||||||
vtimer_now(&after);
|
xtimer_now_timex(&after);
|
||||||
auto diff = timex_sub(after, before);
|
auto diff = timex_sub(after, before);
|
||||||
assert(diff.seconds >= timeout);
|
assert(diff.seconds >= timeout);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ QUIET ?= 1
|
|||||||
CXXEXFLAGS += -std=c++11
|
CXXEXFLAGS += -std=c++11
|
||||||
|
|
||||||
USEMODULE += cpp11-compat
|
USEMODULE += cpp11-compat
|
||||||
USEMODULE += vtimer
|
USEMODULE += xtimer
|
||||||
USEMODULE += timex
|
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
@ -28,7 +28,7 @@ QUIET ?= 1
|
|||||||
CXXEXFLAGS += -std=c++11
|
CXXEXFLAGS += -std=c++11
|
||||||
|
|
||||||
USEMODULE += cpp11-compat
|
USEMODULE += cpp11-compat
|
||||||
USEMODULE += vtimer
|
USEMODULE += xtimer
|
||||||
USEMODULE += timex
|
USEMODULE += timex
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
@ -122,9 +122,9 @@ int main() {
|
|||||||
puts("Testing sleep_for ...");
|
puts("Testing sleep_for ...");
|
||||||
{
|
{
|
||||||
timex_t before, after;
|
timex_t before, after;
|
||||||
vtimer_now(&before);
|
xtimer_now_timex(&before);
|
||||||
this_thread::sleep_for(chrono::seconds(1));
|
this_thread::sleep_for(chrono::seconds(1));
|
||||||
vtimer_now(&after);
|
xtimer_now_timex(&after);
|
||||||
auto diff = timex_sub(after, before);
|
auto diff = timex_sub(after, before);
|
||||||
assert(diff.seconds >= 1);
|
assert(diff.seconds >= 1);
|
||||||
}
|
}
|
||||||
@ -135,9 +135,9 @@ int main() {
|
|||||||
puts("Testing sleep_until ...");
|
puts("Testing sleep_until ...");
|
||||||
{
|
{
|
||||||
timex_t before, after;
|
timex_t before, after;
|
||||||
vtimer_now(&before);
|
xtimer_now_timex(&before);
|
||||||
this_thread::sleep_until(riot::now() += chrono::seconds(1));
|
this_thread::sleep_until(riot::now() += chrono::seconds(1));
|
||||||
vtimer_now(&after);
|
xtimer_now_timex(&after);
|
||||||
auto diff = timex_sub(after, before);
|
auto diff = timex_sub(after, before);
|
||||||
assert(diff.seconds >= 1);
|
assert(diff.seconds >= 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user