summaryrefslogtreecommitdiff
path: root/tests/api_read_order_ncom_1s2r
diff options
context:
space:
mode:
Diffstat (limited to 'tests/api_read_order_ncom_1s2r')
-rw-r--r--tests/api_read_order_ncom_1s2r/out6
-rw-r--r--tests/api_read_order_ncom_1s2r/receiver.py4
-rw-r--r--tests/api_read_order_ncom_1s2r/sender.py4
-rwxr-xr-xtests/api_read_order_ncom_1s2r/simulator.py17
4 files changed, 31 insertions, 0 deletions
diff --git a/tests/api_read_order_ncom_1s2r/out b/tests/api_read_order_ncom_1s2r/out
new file mode 100644
index 0000000..9172791
--- /dev/null
+++ b/tests/api_read_order_ncom_1s2r/out
@@ -0,0 +1,6 @@
+[t=0.000,src=n0] wlan0 is 0
+[t=0.000,src=n2] wlan0 is 0
+[t=0.000,src=n1] Send 1 bytes on wlan0
+[t=1.000,src=n0] Receive 1 bytes on wlan0
+[t=1.000,src=n2] Receive 1 bytes on wlan0
+[t=1.000,src=esds] Simulation ends
diff --git a/tests/api_read_order_ncom_1s2r/receiver.py b/tests/api_read_order_ncom_1s2r/receiver.py
new file mode 100644
index 0000000..7bcf70e
--- /dev/null
+++ b/tests/api_read_order_ncom_1s2r/receiver.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+
+def execute(api):
+ api.log("wlan0 is {}".format(api.read("ncom_wlan0"))) # Ensure no commmunications at t=0s
diff --git a/tests/api_read_order_ncom_1s2r/sender.py b/tests/api_read_order_ncom_1s2r/sender.py
new file mode 100644
index 0000000..b13bab3
--- /dev/null
+++ b/tests/api_read_order_ncom_1s2r/sender.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+
+def execute(api):
+ api.send("wlan0","hello",1,None)
diff --git a/tests/api_read_order_ncom_1s2r/simulator.py b/tests/api_read_order_ncom_1s2r/simulator.py
new file mode 100755
index 0000000..5c3418c
--- /dev/null
+++ b/tests/api_read_order_ncom_1s2r/simulator.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+# Load ESDS
+import esds
+import numpy as np
+
+B=np.full((3,3),8)
+L=np.full((3,3),0)
+s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L, "is_wired":False}, "eth0":{"bandwidth":B, "latency":L, "is_wired":True}})
+
+# Order at which receivers and senders are instanciated should not matter on the result
+# both receivers should have ncom_wlan0 equals to 0 (since non-blocking calls are processed before the blocking one, it should be the case)
+s.create_node("receiver")
+s.create_node("sender")
+s.create_node("receiver")
+
+s.run(interferences=False)