Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ef3cc4

Browse files
committed
[core][utest] add HIL test cases
1 parent dcb58d7 commit 2ef3cc4

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

core/utest/SConscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ src = []
55
if GetDepend('RT_USING_CI_ACTION') or GetDepend('RTDUINO_UTEST_CORE'):
66
src += Glob('TC_*.c')
77
src += Glob('TC_*.cpp')
8+
if not GetDepend('RTDUINO_UTEST_HIL'):
9+
SrcRemove(src, Glob('TC_HIL_*.c'))
10+
SrcRemove(src, Glob('TC_HIL_*.cpp'))
811

912
group = DefineGroup('utestcases', src, depend = [''])
1013

core/utest/TC_HIL_IO.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2021-2025, RTduino Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* https://github.com/RTduino/RTduino
7+
* https://gitee.com/rtduino/RTduino
8+
*
9+
* Change Logs:
10+
* Date Author Notes
11+
* 2025-01-04 Meco Man first version
12+
*/
13+
#include <RTduino.h>
14+
#include <utest.h>
15+
16+
static void TC_digital(void)
17+
{
18+
digitalWrite(D3, LOW);
19+
uassert_true(digitalRead(D3) == LOW);
20+
digitalWrite(D3, HIGH);
21+
uassert_true(digitalRead(D3) == HIGH);
22+
}
23+
24+
/* Utest function to run all test cases */
25+
static void utest_do_tc(void)
26+
{
27+
UTEST_UNIT_RUN(TC_digital);
28+
}
29+
30+
UTEST_TC_EXPORT(utest_do_tc, "RTduino.core.HIL.IO", RT_NULL, RT_NULL, 1000);

0 commit comments

Comments
 (0)