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
5
tests/api_receivet0_eth0_1s1r/out
Normal file
5
tests/api_receivet0_eth0_1s1r/out
Normal file
|
@ -0,0 +1,5 @@
|
|||
[t=0.000,src=n0] Send 1 bytes to n1 on eth0
|
||||
[t=0.000,src=n1] Receive failed code=-1
|
||||
[t=1.000,src=n1] Receive 1 bytes on eth0
|
||||
[t=1.000,src=n1] Received: Hello World!
|
||||
[t=1.000,src=esds] Simulation ends
|
14
tests/api_receivet0_eth0_1s1r/receiver.py
Normal file
14
tests/api_receivet0_eth0_1s1r/receiver.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
def receivet(node,timeout):
|
||||
##### Simple receive
|
||||
code, data=node.receivet("eth0",timeout)
|
||||
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
|
||||
node.log(msg)
|
||||
|
||||
def execute(api):
|
||||
# Should not works since communication start at t=0s
|
||||
receivet(api,0)
|
||||
api.wait(1)
|
||||
# Now communication started
|
||||
receivet(api,0) # Should work (no timeout error)
|
5
tests/api_receivet0_eth0_1s1r/sender.py
Normal file
5
tests/api_receivet0_eth0_1s1r/sender.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
def execute(api):
|
||||
api.send("eth0","Hello World!",1,1)
|
||||
|
14
tests/api_receivet0_eth0_1s1r/simulator.py
Executable file
14
tests/api_receivet0_eth0_1s1r/simulator.py
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Load ESDS
|
||||
import esds
|
||||
import numpy as np
|
||||
|
||||
B=np.full((2,2),8)
|
||||
L=np.full((2,2),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("receiver")
|
||||
|
||||
s.run()
|
43
tests/api_receivet0_eth0_1s1r/yoctosim.debug
Normal file
43
tests/api_receivet0_eth0_1s1r/yoctosim.debug
Normal file
|
@ -0,0 +1,43 @@
|
|||
Python version 3.10.5 (main, Jun 6 2022, 18:49:26) [GCC 12.1.0]
|
||||
Simulation started at 1654802960.7880125
|
||||
Number of nodes is 2
|
||||
Manual breakpoints list: []
|
||||
Breakpoints every Nones
|
||||
-----------------------------------------------
|
||||
Started since 0.02s
|
||||
Simulated time 0.000s (or more precisely 0s)
|
||||
Node number per state: pending=1 request=1
|
||||
Node sharing: n1=1
|
||||
Ids of node in timeout mode:
|
||||
Sorted events list:
|
||||
[[0 1.0 array([0, 1, 'eth0', 'Hello World!', 1, 1.0, 1, 0], dtype=object)
|
||||
1]
|
||||
[1 2 array(1, dtype=object) 3]]
|
||||
-----------------------------------------------
|
||||
Started since 0.04s
|
||||
Simulated time 1.000s (or more precisely 1.0s)
|
||||
Node number per state: pending=1 request=1
|
||||
Node sharing: n1=1
|
||||
Ids of node in timeout mode:
|
||||
Sorted events list:
|
||||
[[1 1.5 array(1, dtype=object) 3]
|
||||
[0 2.0
|
||||
array([0, 1, 'eth0', 'Hello World!', 1, 1.0, 1, 1.0], dtype=object) 1]]
|
||||
-----------------------------------------------
|
||||
Started since 0.06s
|
||||
Simulated time 1.500s (or more precisely 1.5s)
|
||||
Node number per state: pending=1 request=1
|
||||
Node sharing: n1=1
|
||||
Ids of node in timeout mode:
|
||||
Sorted events list:
|
||||
[[0 2.0
|
||||
array([0, 1, 'eth0', 'Hello World!', 1, 1.0, 1, 1.0], dtype=object) 1]
|
||||
[1 2.0 array(1, dtype=object) 3]]
|
||||
-----------------------------------------------
|
||||
Started since 0.08s
|
||||
Simulated time 2.000s (or more precisely 2.0s)
|
||||
Node number per state: terminated=2
|
||||
Node sharing:
|
||||
Ids of node in timeout mode:
|
||||
Sorted events list:
|
||||
[]
|
Loading…
Add table
Add a link
Reference in a new issue