Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hanakl committed Dec 8, 2024
1 parent 95f4061 commit aba9ad3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
30 changes: 30 additions & 0 deletions test/test_plotting_3_maps.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using FileIO

sizes = [2,3,5]
registers = Register[]
for s in sizes
traits = [Qubit() for _ in 1:s]
bg = [T2Dephasing(1.0) for _ in 1:s]
push!(registers, Register(traits,bg))
end
network = RegisterNet(registers)
map_axis = generate_map()
coords = [Point2f(-71, 42), Point2f(-111, 34), Point2f(-122, 37)]
_, _, plt, netobs = registernetplot_axis(map_axis, net, registercoords=coords)
save(File{format"PNG"}(mktemp()[1]), fig)

initialize!(network[1,1])
initialize!(network[2,1])
notify(netobs)
save(File{format"PNG"}(mktemp()[1]), fig)

apply!([network[1,1],network[2,1]], CNOT)
notify(netobs)
save(File{format"PNG"}(mktemp()[1]), fig)

display(fig)

fig = Figure()
map_axis = generate_map(fig[1, 1])
_, _, plt, netobs = registernetplot_axis(map_axis , net, registercoords=coords)
save(File{format"PNG"}(mktemp()[1]), fig)
3 changes: 3 additions & 0 deletions test/test_plotting_cairo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ end
@testset "arguments and observables and tags" begin
include("test_plotting_2_tags_observables.jl")
end
@testset "background map" begin
include("test_plotting_3_maps.jl")
end
end
4 changes: 3 additions & 1 deletion test/test_plotting_gl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ end
@testset "arguments and observables and tags" begin
include("test_plotting_2_tags_observables.jl")
end

@testset "background map" begin
include("test_plotting_3_maps.jl")
end
@testset "data inspectors" begin # only available in GLMakie
# create a network of qubit registers
net = RegisterNet([Register(2),Register(3),Register(2),Register(5)])
Expand Down

0 comments on commit aba9ad3

Please sign in to comment.