Skip to content

Commit dafad80

Browse files
committed
update tests to use eqsn
1 parent 6c05550 commit dafad80

File tree

3 files changed

+16
-26
lines changed

3 files changed

+16
-26
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ networkx==2.4
33
nose2==0.9.1
44
numpy==1.18.1
55
projectq==0.4.2
6-
eqsn==0.0.3
6+
eqsn==0.0.4

tests/integration_test_single_hop/max_wait_for_ack_check.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
1-
from cqc.pythonLib import CQCConnection
2-
import sys
3-
import time
4-
5-
sys.path.append("../..")
6-
from backends.cqc_backend import CQCBackend
71
from components.host import Host
82
from components.network import Network
9-
from objects.qubit import Qubit
3+
from backends.eqsn_backend import EQSNBackend
104

115

126
def main():
13-
backend = CQCBackend()
7+
backend = EQSNBackend()
148
network = Network.get_instance()
159
nodes = ["Alice", "Bob", "Eve", "Dean"]
1610
network.start(nodes, backend)
17-
network.delay = 0.7
11+
network.delay = 0.0
1812

1913
hosts = {'alice': Host('Alice', backend),
2014
'bob': Host('Bob', backend)}
2115

22-
2316
# A <-> B
2417
hosts['alice'].add_connection('Bob')
2518
hosts['bob'].add_connection('Alice')
@@ -30,9 +23,11 @@ def main():
3023
for h in hosts.values():
3124
network.add_host(h)
3225

33-
ack_received_1 = hosts['alice'].send_classical(hosts['bob'].host_id, 'hello bob one', await_ack=True)
26+
ack_received_1 = hosts['alice'].send_classical(
27+
hosts['bob'].host_id, 'hello bob one', await_ack=True)
3428
hosts['alice'].max_ack_wait = 0.0
35-
ack_received_2 = hosts['alice'].send_classical(hosts['bob'].host_id, 'hello bob one', await_ack=True)
29+
ack_received_2 = hosts['alice'].send_classical(
30+
hosts['bob'].host_id, 'hello bob one', await_ack=True)
3631
assert ack_received_1
3732
assert not ack_received_2
3833
print("All tests succesfull!")

tests/integration_test_single_hop/packet_loss_classical_check.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
1-
from cqc.pythonLib import CQCConnection
2-
import sys
3-
import time
4-
5-
sys.path.append("../..")
6-
from backends.cqc_backend import CQCBackend
71
from components.host import Host
82
from components.network import Network
9-
from objects.qubit import Qubit
3+
from backends.eqsn_backend import EQSNBackend
104

115

126
def main():
13-
backend = CQCBackend()
7+
backend = EQSNBackend()
148
network = Network.get_instance()
159
nodes = ["Alice", "Bob", "Eve", "Dean"]
1610
network.start(nodes, backend)
17-
network.delay = 0.1
11+
network.delay = 0.0
1812

1913
hosts = {'alice': Host('Alice', backend),
2014
'bob': Host('Bob', backend)}
2115

2216
network.start(nodes, backend)
23-
network.packet_drop_rate = 0.75
17+
network.packet_drop_rate = 0.5
2418
network.delay = 0
2519

2620
hosts['alice'].add_connection('Bob')
@@ -33,12 +27,13 @@ def main():
3327
network.add_host(h)
3428

3529
# ACKs for 1 hop take at most 2 seconds
36-
hosts['alice'].max_ack_wait = 3
30+
hosts['alice'].max_ack_wait = 0.5
3731
num_acks = 0
3832
# don't make more then 10 attempts, since of receiver window.
39-
num_messages = 10
33+
num_messages = 20
4034
for _ in range(num_messages):
41-
ack = hosts['alice'].send_classical(hosts['bob'].host_id, 'Hello Bob', await_ack=True)
35+
ack = hosts['alice'].send_classical(
36+
hosts['bob'].host_id, 'Hello Bob', await_ack=True)
4237
if ack:
4338
num_acks += 1
4439

0 commit comments

Comments
 (0)