mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-04-19 12:09:44 +00:00
Improve tests
This commit is contained in:
parent
1bef51d878
commit
d0ae9f3296
85 changed files with 77 additions and 44 deletions
9
tests/api_read_eth0_ncom_2s1r/out
Normal file
9
tests/api_read_eth0_ncom_2s1r/out
Normal file
|
@ -0,0 +1,9 @@
|
|||
[t=0.000,src=n2] eth0 is 0
|
||||
[t=624.000,src=n2] eth0 is 0
|
||||
[t=1248.000,src=n0] Send 50 bytes to n2 on eth0
|
||||
[t=1249.000,src=n2] eth0 is 1
|
||||
[t=1249.000,src=n1] Send 50 bytes to n2 on eth0
|
||||
[t=1250.000,src=n2] eth0 is 2
|
||||
[t=1513.667,src=n2] Receive 50 bytes on eth0
|
||||
[t=1514.667,src=n2] Receive 50 bytes on eth0
|
||||
[t=1514.667,src=esds] Simulation ends
|
13
tests/api_read_eth0_ncom_2s1r/receiver.py
Normal file
13
tests/api_read_eth0_ncom_2s1r/receiver.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
def execute(api):
|
||||
api.log("eth0 is {}".format(api.read("ncom_eth0"))) # Ensure no commmunications at t=0s
|
||||
api.wait(624)
|
||||
api.log("eth0 is {}".format(api.read("ncom_eth0"))) # Ensure still no commmunications at t=624s
|
||||
api.wait(624)
|
||||
# Now we are at 624*2=1248 (first sender start a communication)
|
||||
api.wait(1) # Let the communication starts (otherwise value will be 0 (see api_read_order_ncom_1s2r))
|
||||
api.log("eth0 is {}".format(api.read("ncom_eth0"))) # Should print 1
|
||||
# Now second sender start a communication
|
||||
api.wait(1) # Let the second communication starts
|
||||
api.log("eth0 is {}".format(api.read("ncom_eth0"))) # Should print 2
|
9
tests/api_read_eth0_ncom_2s1r/sender.py
Normal file
9
tests/api_read_eth0_ncom_2s1r/sender.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
def execute(api):
|
||||
api.wait(1248) # All communications start at t=1248s
|
||||
if api.node_id==0:
|
||||
api.send("eth0","hello",50,2)
|
||||
else:
|
||||
api.wait(1) # Second sender start 1s after the first
|
||||
api.send("eth0","hello",50,2)
|
15
tests/api_read_eth0_ncom_2s1r/simulator.py
Executable file
15
tests/api_read_eth0_ncom_2s1r/simulator.py
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Load ESDS
|
||||
import esds
|
||||
import numpy as np
|
||||
|
||||
B=np.full((3,3),3)
|
||||
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("sender")
|
||||
s.create_node("sender")
|
||||
s.create_node("receiver")
|
||||
|
||||
s.run(interferences=False)
|
Loading…
Add table
Add a link
Reference in a new issue