Skip to content

Commit fb99038

Browse files
committed
chore: cleanup test
1 parent 22da59d commit fb99038

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

tests/test-button.robot

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,42 @@
1-
# Filename: test-button.robot
21
*** Settings ***
32
Suite Setup Setup
43
Suite Teardown Teardown
5-
Test Setup Reset Emulation
4+
Test Setup Reset And Load System
65
Resource ${RENODEKEYWORDS}
76
7+
*** Variables ***
8+
${REPL} ${CURDIR}/../nucleo_f446re_custom.repl
9+
${ELF} ${CURDIR}/../nucleo-f446re/ButtonLed/build/ButtonLed.elf
10+
${LED} sysbus.gpioa.greenled2
11+
${BUTTON} sysbus.gpioc.bluebutton
12+
813
*** Test Cases ***
914
Button Press should Toggle LED
10-
Execute Command mach create
11-
Execute Command machine LoadPlatformDescription @${CURDIR}/../nucleo_f446re_custom.repl
12-
Execute Command sysbus LoadELF @${CURDIR}/../nucleo-f446re/ButtonLed/build/ButtonLed.elf
15+
[Documentation] Verifies that the LED toggles its state on every
16+
... button click.
1317
14-
Start Emulation
15-
16-
${LedState}= Execute Command sysbus.gpioa.greenled2 State
17-
Should Be Equal ${LedState.strip()} False
18-
19-
Execute Command sysbus.gpioc.bluebutton Press
20-
sleep 100milliseconds
21-
Execute Command sysbus.gpioc.bluebutton Release
18+
LED State Should Be False
2219

23-
${LedState}= Execute Command sysbus.gpioa.greenled2 State
24-
Should Be Equal ${LedState.strip()} True
20+
Toggle Button
21+
LED State Should Be True
22+
23+
Toggle Button
24+
LED State Should Be False
25+
26+
*** Keywords ***
27+
Reset And Load System
28+
Reset Emulation
29+
Execute Command mach create
30+
Execute Command machine LoadPlatformDescription @${REPL}
31+
Execute Command sysbus LoadELF @${ELF}
32+
Start Emulation
2533
26-
Execute Command sysbus.gpioc.bluebutton Press
27-
sleep 100milliseconds
28-
Execute Command sysbus.gpioc.bluebutton Release
34+
Toggle Button
35+
Execute Command ${BUTTON} Press
36+
Sleep 100ms # Small delay for debouncing logic in firmware
37+
Execute Command ${BUTTON} Release
2938
30-
${LedState}= Execute Command sysbus.gpioa.greenled2 State
31-
Should Be Equal ${LedState.strip()} False
32-
39+
LED State Should Be
40+
[Arguments] ${expected_state}
41+
${current_state}= Execute Command ${LED} State
42+
Should Be Equal ${current_state.strip()} ${expected_state}

0 commit comments

Comments
 (0)