Skip to content

Commit

Permalink
some more imports for interactive testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Krastanov committed Dec 19, 2024
1 parent bdb030b commit dc602ef
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/test_protocolzoo_entanglement_consumer.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@testitem "ProtocolZoo Entanglement Consumer" tags=[:protocolzoo_entanglement_consumer] begin
using QuantumSavory
using QuantumSavory.ProtocolZoo: EntanglerProt, SwapperProt, EntanglementTracker, EntanglementConsumer
using Graphs
using ConcurrentSim
Expand Down Expand Up @@ -49,19 +50,19 @@ for n in 3:30
regsize = 10
net = RegisterNet([Register(regsize) for j in 1:n])
sim = get_time_tracker(net)

@resumable function delayedProts(sim)
@yield timeout(sim, 5)
for e in edges(net)
eprot = EntanglerProt(sim, net, e.src, e.dst; rounds=-1, randomize=true, margin=5, hardmargin=3)
@process eprot()
end

for v in 2:n-1
sprot = SwapperProt(sim, net, v; nodeL = <(v), nodeH = >(v), chooseL = argmin, chooseH = argmax, rounds = -1)
@process sprot()
end

for v in vertices(net)
etracker = EntanglementTracker(sim, net, v)
@process etracker()
Expand All @@ -70,13 +71,13 @@ for n in 3:30
econ = EntanglementConsumer(sim, net, 1, n; period=nothing)
@process econ()
@process delayedProts(sim)
run(sim, 100)

run(sim, 100)

@test econ.log[1][1] > 5 # the process should start after 5
for i in 1:length(econ.log)
@test econ.log[i][2] 1.0
@test econ.log[i][3] 1.0
end
end
end
end

0 comments on commit dc602ef

Please sign in to comment.