import qiskit
from qiskit_reg_by_const_qft_adder import reg_by_const_qft_adder
from numeric_systems import *
from typing import *
from test_tools import *

for a in range(-4, 3):
    for c in range(-4, 3):
        #Create the quantum circuit
        my_circuit = qiskit.QuantumCircuit(4)

        #Initialize register with $a$
        a_binary = integer_to_binary(a, 4)
        for i in range(4):
            if a_binary[i] == True:
                my_circuit.x(i)

        #Create gate
        g = reg_by_const_qft_adder(4, c)

        #Append gate to the circuit
        my_circuit.append(g, list(range(4)))

        #Append measurements
        my_circuit.measure_all()

        #Simulation
        result_binary = one_shot_simulation(my_circuit)
        result_integer = binary_to_integer(result_binary)
        print(f'a={a}, c={c}, result={result_integer}')