Skip to content

Commit

Permalink
[add] more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mc-Zen committed Feb 23, 2024
1 parent 1f86c52 commit 137743c
Show file tree
Hide file tree
Showing 46 changed files with 276 additions and 0 deletions.
Binary file added tests/decorations/lstick rstick/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/decorations/lstick rstick/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/decorations/lstick rstick/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/decorations/lstick rstick/ref/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/decorations/lstick rstick/ref/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions tests/decorations/lstick rstick/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *


#quantum-circuit(
lstick("a"), gate($H$), rstick("b"), [\ ],
1, gate($H$), rstick($mat(a,b;c,d,)$, n: 3), [\ ],
lstick("asd", n: 2), gate($H$), 1, [\ ],
1, gate($T$), 1
)

#pagebreak()

#quantum-circuit(
lstick("single with brace", brace: "{"), gate($H$), rstick("b", brace: "]"), [\ ],
1, gate($H$), rstick($mat(a,b;c,d)$, n: 3, brace: none), [\ ],
lstick("nobrace", n: 2, brace: none), gate($H$), 1, [\ ],
1, gate($T$), 1
)

#pagebreak()

#quantum-circuit(
1, gate($H$), rstick($mat(a,b;c,d)$, n: 3, brace: "|"), [\ ],
lstick("[-brace", n: 2, brace: "["), gate($H$), 1, [\ ],
1, gate($T$), 1
)

#pagebreak()

#quantum-circuit(
lstick("very long lstick"), 1
)

#pagebreak()

#quantum-circuit(
1, rstick("very long rstick")
)
Binary file added tests/gates/custom colors/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions tests/gates/custom colors/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *


#quantum-circuit(
gate($X$, fill: gray), phase($#text([a], fill: red)$, fill: red), phase($#text([a], fill: red)$, fill: .7pt + red, open: true), gate($F_m$, radius: 100%), gate($F#h(.2em)$, radius: (right: 100%), fill: green), targ(fill: true), targ(fill: blue), ctrl(0, fill: blue), ctrl(0, fill: .7pt + blue, open: true), ctrl(0, fill: blue), ctrl(0, fill: .7pt + blue, open: true), 1
)
Binary file added tests/gates/custom gate size/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/gates/custom gate size/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions tests/gates/custom gate size/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *


#quantum-circuit(
targ(), targ(size: 6pt), targ(size: 3pt), ctrl(0), ctrl(0, size: 4pt), ctrl(0, open: true), ctrl(0, size: 4pt, open: true), ctrl(0), ctrl(0, size: 4pt)
)

#pagebreak()

#quantum-circuit(scale-factor: 70%,
targ(), targ(size: 6pt), targ(size: 3pt), ctrl(0), ctrl(0, size: 4pt), ctrl(0, open: true), ctrl(0, size: 4pt, open: true), ctrl(0), ctrl(0, size: 4pt)
)
Binary file added tests/gates/custom gate/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions tests/gates/custom gate/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *


#let draw-par-gate(gate, draw-params) = {
let stroke = draw-params.wire
let fill = if gate.fill != none { gate.fill } else {draw-params.background }
box(
gate.content,
fill: fill, stroke: (left: stroke, right: stroke),
inset: draw-params.padding
)
}

#box(quantum-circuit(
1, gate("Quill", draw-function: draw-par-gate), 1,
), fill: gray)
Binary file added tests/gates/inputs and outputs/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions tests/gates/inputs and outputs/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *

#quantum-circuit(
1, mqgate($U$, n: 3, width: 5em,
inputs: (
(qubit: 0, n: 2, label: $x$),
(qubit: 2, label: $y$)
),
outputs: (
(qubit: 0, n: 2, label: $x$),
(qubit: 2, label: $y plus.circle f(x)$)
),
), 1, [\ ], 3, [\ ], 3
)
Binary file added tests/gates/meter/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/gates/meter/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/gates/meter/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions tests/gates/meter/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *

#quantum-circuit(
1, meter(n: 3), [\ ], 2, [\ ], 2
)

#pagebreak()

#quantum-circuit(
scale-factor: 120%,
1, meter(label: $y$), 1, meter(n: 1, label: $lr(|plus.minus〉)$), meter(label: $phi/2$, n: 1, wire-count: 1), meter(target: 1, label: $X$), meter(n: 2, label: $X$), [\ ],
1, meter(radius: 3pt, fill: gray), 3,ctrl(0), 1
)

#pagebreak()

#quantum-circuit(
gate-padding: 2pt,
wire: .2pt + red,
color: red,
// scale-factor: 200%,
1, meter(label: $y$), 1, meter(n: 1, label: $lr(|plus.minus〉)$), meter(label: $phi/2$, n: 1, wire-count: 1), meter(target: 1, label: "a"), meter(n: 2, label: "a"), [\ ],
1, gate($H$), ctrl(0), 2
)
Binary file added tests/gates/nwire/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions tests/gates/nwire/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *


#quantum-circuit(
1, nwire(1), nwire($2$), nwire($n$), nwire("p"), nwire($2n+1$), 2,
)
Binary file added tests/gates/permute/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions tests/gates/permute/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *


#quantum-circuit(
2, permute(1,0), permute(1,0), 1, permute(2,0,1), 2, [\ ],
2, 4,permute(1,0), 1, [\ ],
2, gate($H$), 5,
)
Binary file added tests/labels/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/labels/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/labels/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/labels/ref/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/labels/ref/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/labels/ref/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/labels/ref/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/labels/ref/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/labels/ref/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions tests/labels/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *


#let labels-everywhere = (
(content: "lt", pos: left + top),
(content: "t", pos: top),
(content: "rt", pos: right + top),
(content: "l", pos: left),
(content: "c", pos: center),
(content: "r", pos: right),
(content: "lb", pos: left + bottom),
(content: "b", pos: bottom),
(content: "rb", pos: right + bottom),
)
#quantum-circuit(
gate(hide[H], label: labels-everywhere),
)

#pagebreak()

#quantum-circuit(
1, mqgate(hide[Gate], n: 2, label: labels-everywhere), 1, [\ ],
3,
)

#pagebreak()

#quantum-circuit(
gategroup(1, 2, label: labels-everywhere), gate($X$), gate($Y$),
)

#pagebreak()

#quantum-circuit(
1, ctrl(0, label: (content: "al", pos: right + top)), 1
)

#pagebreak()

#quantum-circuit(
1, slice(label: labels-everywhere), 1, [\ ],
2, [\ ],
2, [\ ],
2, [\ ],
2, [\ ],
2,
)

#pagebreak()

#quantum-circuit(
gate("H", label: ((content: "H", pos: left, dx: 0pt, dy: 0pt))),
)

#pagebreak()

#quantum-circuit(
gate("H", label: ((content: "H", pos: bottom, dx: 0pt, dy: 0pt)))
)

#pagebreak()

#quantum-circuit(
2, slice(label: (content: "E", pos: top)),
gategroup(1,2,padding: 1em, radius: 2em, label: (content: "E", pos: bottom)), gate($H$, label: (content: "E", pos: top, dx: 50% + 2em, dy: 50%)), 2,
)

#pagebreak()

#quantum-circuit(
1, $H$, 1, $H$,[H],$I$, $S$, "H", [\ ],
lstick($|0〉$, label: "System 1"), gate($H$, label: "a"), 1, midstick("mid", label: (content: "r", pos: bottom)), 1, rstick($F$, label: "a")
)
Binary file added tests/layout/gutter/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions tests/layout/gutter/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *

#box(fill: red, quantum-circuit(
column-spacing: 0pt,
row-spacing: 0pt,
10pt /*should be ignored*/,
gate($H$), 5pt, 10pt, 5pt, gate($H$), 10pt, gate($H$), [\ ], 10pt,
gate($H$), gate($H$), gate($H$), [\ ], 10pt, 20pt,
gate($H$), gate($H$),20pt, gate($H$),
))
Binary file added tests/layout/relative for row,col spacing/ref/1.png
Binary file added tests/layout/relative for row,col spacing/ref/2.png
18 changes: 18 additions & 0 deletions tests/layout/relative for row,col spacing/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *

#quantum-circuit(
column-spacing: 1em,
row-spacing: 1em,
gate($H$), gate($H$), [\ ],
gate($H$), 1
)

#pagebreak()

#quantum-circuit(
min-row-height: 1em,
min-column-width: 1em,
gate($H$), gate($H$), [\ ],
gate($H$), 1
)
Binary file added tests/wire/control wires/ref/1.png
16 changes: 16 additions & 0 deletions tests/wire/control wires/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *

#quantum-circuit(circuit-padding: 0pt,
mqgate($a$, target: 1, wire-count: 1, wire-label: (content: "a", dx: 0pt)),
ctrl(1, wire-count: 2, wire-label: (content: "a", dx: 0pt)),
swap(1, wire-count: 3, wire-label: (content: "a", dx: 0pt)),
mqgate($a$, target: 1, wire-count: 4, wire-label: (content: "a", dx: 0pt)),
mqgate($a$, target: 1, wire-count: 5, wire-label: (content: "abcde", dx: 0pt)),[\ ],
mqgate($a$, target: 1, wire-count: 1),
ctrl(1, wire-count: 2),
swap(1, wire-count: 3),
mqgate($a$, target: 1, wire-count: 4),
mqgate($a$, target: 1, wire-count: 5),[\ ],
5
)
Binary file added tests/wire/mode/ref/1.png
10 changes: 10 additions & 0 deletions tests/wire/mode/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *

#quantum-circuit(
gate($H$), slice(), setwire(2), gate($X$), setwire(0), meter(), [\ ],
setwire(0), gate($X$), setwire(1), 1, setwire(2), gate($X$),1, [\ ],
1, setwire(1, stroke: (paint: blue, dash: "dash-dotted", thickness: .7pt, )), 1, setwire(2),1, [\ ],
1, [\ ],
2, setwire(2), 1, setwire(3), 1, setwire(4), 1, setwire(5), 1
)
Binary file added tests/wire/plain vertical wire/ref/1.png
4 changes: 4 additions & 0 deletions tests/wire/plain vertical wire/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *

#quantum-circuit(1, ctrl(1, show-dot: false), 1, [\ ], 3)
Binary file added tests/wire/targ, control, phase/ref/1.png
11 changes: 11 additions & 0 deletions tests/wire/targ, control, phase/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ": *

#quantum-circuit(
scale: 150%,
1, targ(), ctrl(0, open: true), phase($α$, open: true), 1, [\ ],
setwire(2),
1, targ(fill: true), ctrl(0, open: true), phase($α$, open: true), 1, [\ ],
setwire(3),
1, targ(fill: true), ctrl(0, open: true), phase($α$, open: true), 1,
)

0 comments on commit 137743c

Please sign in to comment.