From 0b58445c3d3eca004979e5af4ef448fc25ddfc1c Mon Sep 17 00:00:00 2001 From: Terraneo Federico <fede.tft@miosix.org> Date: Sat, 28 Aug 2021 12:16:43 +0200 Subject: [PATCH] Test that os_timer frequency and delayMs agree --- miosix/_tools/testsuite/testsuite.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/miosix/_tools/testsuite/testsuite.cpp b/miosix/_tools/testsuite/testsuite.cpp index 6b08c7b5..e3b79c25 100644 --- a/miosix/_tools/testsuite/testsuite.cpp +++ b/miosix/_tools/testsuite/testsuite.cpp @@ -846,6 +846,11 @@ static void t3_p2(void *argv) static void test_3() { test_name("time and sleep"); + auto start=getTime(); + delayMs(10); + auto delta=getTime()-start; + //10% tolerance + if(delta<9000000 || delta>11000000) fail("getTime and delayMs don't agree"); Thread *p=Thread::create(t3_p1,STACK_SMALL,0,NULL,Thread::JOINABLE); for(int i=0;i<4;i++) { -- GitLab