Share via


%kata

Avviso

Questa documentazione si riferisce al QDK classico, che è stato sostituito dal QDK moderno.

QDK moderno supporta solo il comando magic '%%qsharp'.

Riepilogo

Esegue un singolo test.

Descrizione

Esegue un singolo test e segnala se il test è stato superato correttamente.

Esempi per %kata

Esempio 1

Per eseguire un test denominato Test:

In []: %kata T101_StateFlip
       operation StateFlip (q : Qubit) : Unit is Adj + Ctl {
           // The Pauli X gate will change the |0⟩ state to the |1⟩ state and vice versa.
           // Type X(q);
           // Then run the cell using Ctrl/⌘+Enter.

           // ...
       }
Out[]: Qubit in invalid state. Expecting: Zero
       	Expected:	0
       	Actual:	0.5000000000000002
       Try again!