mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-05-10 17:40:50 +00:00
Improve tests
This commit is contained in:
parent
1bef51d878
commit
d0ae9f3296
85 changed files with 77 additions and 44 deletions
tests/api_send_wlan0_1s2r
29
tests/api_send_wlan0_1s2r/receiver.py
Normal file
29
tests/api_send_wlan0_1s2r/receiver.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
def receive(node):
|
||||
##### Simple receive
|
||||
code, data=node.receive("wlan0")
|
||||
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
|
||||
node.log(msg)
|
||||
|
||||
|
||||
def execute(api):
|
||||
# Should works for all receivers
|
||||
receive(api)
|
||||
|
||||
if api.node_id == 1:
|
||||
receive(api) # Should works
|
||||
else:
|
||||
api.turn_off()
|
||||
api.wait(1) # Node 2 should not receive anything during 1s
|
||||
api.turn_on()
|
||||
|
||||
|
||||
if api.node_id == 1:
|
||||
receive(api) # Should works
|
||||
else:
|
||||
api.wait(0.5) # Check if started communication get cancelled on turning off
|
||||
api.turn_off() # Node 2 should not receive anything
|
||||
api.wait(0.5) # Node 2 should not receive anything during 0.5s
|
||||
api.turn_on()
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue