diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-06-30 12:11:59 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-06-30 12:11:59 +0200 |
| commit | d0ae9f329685a19136cfd9a890b305db3bc384b9 (patch) | |
| tree | b3c72908b8930db16b1f682bb7119abeaf72fadf /tests/api_send_wlan0_1s2r/receiver.py | |
| parent | 1bef51d87860f782f687533012167bebb43c093d (diff) | |
Improve tests
Diffstat (limited to 'tests/api_send_wlan0_1s2r/receiver.py')
| -rw-r--r-- | tests/api_send_wlan0_1s2r/receiver.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/api_send_wlan0_1s2r/receiver.py b/tests/api_send_wlan0_1s2r/receiver.py new file mode 100644 index 0000000..5b86500 --- /dev/null +++ b/tests/api_send_wlan0_1s2r/receiver.py @@ -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() + |
