summaryrefslogtreecommitdiff
path: root/tests/api_wait_end_3n
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-06-30 12:11:59 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2022-06-30 12:11:59 +0200
commitd0ae9f329685a19136cfd9a890b305db3bc384b9 (patch)
treeb3c72908b8930db16b1f682bb7119abeaf72fadf /tests/api_wait_end_3n
parent1bef51d87860f782f687533012167bebb43c093d (diff)
Improve tests
Diffstat (limited to 'tests/api_wait_end_3n')
-rw-r--r--tests/api_wait_end_3n/node.py10
-rw-r--r--tests/api_wait_end_3n/out7
-rwxr-xr-xtests/api_wait_end_3n/simulator.py15
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/api_wait_end_3n/node.py b/tests/api_wait_end_3n/node.py
new file mode 100644
index 0000000..a8fbcd7
--- /dev/null
+++ b/tests/api_wait_end_3n/node.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+def execute(api):
+ wait=api.node_id
+ api.log("Before wait for "+str(wait)+"s")
+ api.wait(wait) # Since 3 nodes max(wait)==2
+
+ # Ensure that wait end return back when simulation ends
+ api.wait_end()
+ api.log("Terminated")
diff --git a/tests/api_wait_end_3n/out b/tests/api_wait_end_3n/out
new file mode 100644
index 0000000..321b0c2
--- /dev/null
+++ b/tests/api_wait_end_3n/out
@@ -0,0 +1,7 @@
+[t=0.000,src=n0] Before wait for 0s
+[t=0.000,src=n1] Before wait for 1s
+[t=0.000,src=n2] Before wait for 2s
+[t=2.000,src=n0] Terminated
+[t=2.000,src=n1] Terminated
+[t=2.000,src=n2] Terminated
+[t=2.000,src=esds] Simulation ends
diff --git a/tests/api_wait_end_3n/simulator.py b/tests/api_wait_end_3n/simulator.py
new file mode 100755
index 0000000..4d1763e
--- /dev/null
+++ b/tests/api_wait_end_3n/simulator.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+
+# Load ESDS
+import esds
+import numpy as np
+
+B=np.full((3,3),2)
+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}})
+
+s.create_node("node")
+s.create_node("node")
+s.create_node("node")
+
+s.run()