def METHOD_NAME(self, function_circuit, reference):
    """Assert that ``function_circuit`` implements the reference function ``reference``."""
    function_circuit._build()
    num_state_qubits = function_circuit.num_state_qubits
    num_ancilla_qubits = function_circuit.num_ancillas
    circuit = QuantumCircuit(num_state_qubits + 1 + num_ancilla_qubits)
    circuit.h(list(range(num_state_qubits)))
    circuit.append(function_circuit.to_instruction(), list(range(circuit.num_qubits)))
    backend = BasicAer.get_backend("statevector_simulator")
    statevector = execute(circuit, backend).result().get_statevector()
    probabilities = defaultdict(float)
    for i, statevector_amplitude in enumerate(statevector):
        i = bin(i)[2:].zfill(circuit.num_qubits)[num_ancilla_qubits:]
        probabilities[i] += np.real(np.abs(statevector_amplitude) ** 2)
    unrolled_probabilities = []
    unrolled_expectations = []
    for i, probability in probabilities.items():
        x, last_qubit = int(i[1:], 2), i[0]
        if last_qubit == "0":
            expected_amplitude = np.cos(reference(x)) / np.sqrt(2**num_state_qubits)
        else:
            expected_amplitude = np.sin(reference(x)) / np.sqrt(2**num_state_qubits)
        unrolled_probabilities += [probability]
        unrolled_expectations += [np.real(np.abs(expected_amplitude) ** 2)]
    np.testing.assert_array_almost_equal(
        unrolled_probabilities, unrolled_expectations, decimal=1
    )