Skip to content

Commit

Permalink
fixup! feat: refine periph timer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smlng committed Oct 10, 2019
1 parent fc69163 commit 5436d2a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
9 changes: 8 additions & 1 deletion dist/robotframework/res/api_shell.keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Library String
Library Collections

Resource util.keywords.txt

*** Keywords ***
API Call Expect
[Documentation] Fails if the result of the given ``call`` does not
Expand All @@ -26,11 +28,16 @@ API Call Should Error
[Arguments] ${call} @{args} &{kwargs}
API Call Expect Error ${call} @{args} &{kwargs}

API Get Last Result As Integer
API Result Data As Integer
[Documentation] Return result of last API call as an integer
${ret}= Convert to Integer ${RESULT['data'][0]}
[Return] ${ret}

API Result Data As List
[Documentation] Return result of last API call as list
${ret}= Set Variable ${RESULT['data']}
[Return] ${ret}

API Result Message Should Contain
[Documentation] Fails if ${msg} is not in the last API message
[Arguments] ${msg}
Expand Down
10 changes: 10 additions & 0 deletions dist/robotframework/res/util.keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*** Settings ***
Library String
Library Collections

*** Keywords ***
Length Should Be Greater
[Documentation] Evaluate length of list to be greater than given number.
[Arguments] ${list} ${gtlen}
${length}= Get Length ${list}
Should be True ${length} > ${gtlen}
8 changes: 4 additions & 4 deletions tests/periph_timer/tests/02__periph_timer_extra.robot
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
*** Settings ***
Documentation Extended functionality checks of the Periph Timer API.
Documentation Verify basic functionality of the Periph Timer API.
# reset application and check DUT has correct firmware, skip all tests on error
Suite Setup Run Keywords PHiLIP.DUT Reset
... API Firmware Should Match
# reset application before running any test
Test Setup Run Keywords PHiLIP.DUT Reset
... API Sync Shell
... Timer Debug Pin

# import libs and keywords
Resource api_shell.keywords.txt
Expand All @@ -18,10 +19,9 @@ Force Tags periph_timer
*** Test Cases ***
Timer Values Should Differ
[Documentation] Verify timer values are different on consecutive reads
API Call Should Succeed Timer Debug Pin dev=0 port=%{DEBUG0_PORT} pin=%{DEBUG0_PIN}
API Call Should Succeed Timer Init freq=%{PERIPH_TIMER_HZ}
API Call Should Succeed Timer Read
${t1}= API Get Last Result As Integer
${t1}= API Result Data As Integer
API Call Should Succeed Timer Read
${t2}= API Get Last Result As Integer
${t2}= API Result Data As Integer
Should Be True ${t2} != ${t1}
3 changes: 2 additions & 1 deletion tests/periph_timer/tests/periph_timer.keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Measure Timer Set Delay
API Call Should Succeed Timer Init freq=%{PERIPH_TIMER_HZ}
API Call Should Succeed Timer Set dev=0 chan=0 ticks=${ticks}
API Call Should Succeed PHiLIP.Read Trace
${trace}= Set Variable ${RESULT['data']}
${trace}= API Result Data As List
Length Should Be Greater ${trace} 1
${delay}= Evaluate ${trace}[-1][time] - ${trace}[-2][time]
Log Many ${ticks} ${delay}
4 changes: 2 additions & 2 deletions tests/xtimer_cli/tests/01__xtimer_base.robot
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Xtimer Now Should Succeed
Xtimer Values Should Increase
[Documentation] Verify xtimer values are monotonously increasing.
API Call Should Succeed Xtimer Now
${t1}= API Get Last Result As Integer
${t1}= API Result Data As Integer
API Call Should Succeed Xtimer Now
${t2}= API Get Last Result As Integer
${t2}= API Result Data As Integer
Should Be True ${t2} > ${t1}

0 comments on commit 5436d2a

Please sign in to comment.