def test_simulate(): """ Checks that a simple simulate works correctly, both using callable() and callable.simulate() """ from Microsoft.Quantum.SanityTests import HelloQ, HelloAgain assert HelloQ() == HelloQ.simulate() == () assert HelloAgain(count=1, name="Ada") == HelloAgain.simulate(count=1, name="Ada")
def test_estimate(): """ Verifies that resource estimation works. """ from Microsoft.Quantum.SanityTests import HelloAgain r = HelloAgain.estimate_resources(count=4, name="estimate test") assert r['Measure'] == 8 assert r['QubitClifford'] == 1 assert r['BorrowedWidth'] == 0
def test_trace(): """ Verifies the trace commands works. """ from Microsoft.Quantum.SanityTests import HelloAgain r = HelloAgain.trace(count=1, name="trace test") print(r) assert len(r['qubits']) == 1 assert len(r['operations']) == 1 assert len(r['operations'][0]['children']) == 2 assert r['operations'][0]['gate'] == 'HelloAgain' assert r['operations'][0]['children'][0]['gate'] == 'M' assert r['operations'][0]['children'][1]['gate'] == 'Reset'