From aba9ad39caa7c6fb28dd49b8a817e7daeee6b427 Mon Sep 17 00:00:00 2001 From: hanakl Date: Sat, 7 Dec 2024 23:14:28 -0800 Subject: [PATCH] Add tests --- test/test_plotting_3_maps.jl | 30 ++++++++++++++++++++++++++++++ test/test_plotting_cairo.jl | 3 +++ test/test_plotting_gl.jl | 4 +++- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 test/test_plotting_3_maps.jl diff --git a/test/test_plotting_3_maps.jl b/test/test_plotting_3_maps.jl new file mode 100644 index 0000000..1be9179 --- /dev/null +++ b/test/test_plotting_3_maps.jl @@ -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) \ No newline at end of file diff --git a/test/test_plotting_cairo.jl b/test/test_plotting_cairo.jl index 86363b1..6950296 100644 --- a/test/test_plotting_cairo.jl +++ b/test/test_plotting_cairo.jl @@ -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 diff --git a/test/test_plotting_gl.jl b/test/test_plotting_gl.jl index 6ed88b6..4364a30 100644 --- a/test/test_plotting_gl.jl +++ b/test/test_plotting_gl.jl @@ -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)])