def testSelectValueFromInitializedRegister(self):
        qcomp = get_functional_computer(nregisters=4, sqrt_size=3)
        value = "001001001"
        expected_value = ComplexM(1, 9, [[0, 0, 1, 0, 0, 1, 0, 0, 1]])

        qcomp.execute(instr_initialize(0, value))
        qcomp.execute(instr_select('V1', 0, 0, 9))

        self.assertEquals(expected_value, qcomp.variables['V1'].value)
 def testSelectOutOfBoundsRaiseAnError(self):
     qcomp = get_functional_computer(nregisters=4, sqrt_size=3)
     qcomp.execute(instr_initialize(0))
     with self.assertRaises(IndexError):
         qcomp.execute(instr_select('V1', 0, 0, 10))
    def testSelectFromNotInitializedRegistersRaisesAnError(self):
        qcomp = get_functional_computer(nregisters=4, sqrt_size=3)

        with self.assertRaises(UnboundLocalError):
            qcomp.execute(instr_select('V1', 0, 1, 2))