Example #1
0
    def testStruct(self):
        ty = Type.int8()
        sty = Type.structure([ty, ty], False)
        x = Value.const_int(ty, 1, True)
        y = Value.const_int(ty, 2, True)
        xy = Value.const_struct([x, y])

        self.assertTrue(xy.is_const_struct())
        [x_, y_] = xy.operands
        self.assertEqual(x, x_)
        self.assertEqual(y, y_)
Example #2
0
    def testStruct(self):
        ty = Type.int8()
        sty = Type.structure([ty, ty], False)
        x = Value.const_int(ty, 1, True)
        y = Value.const_int(ty, 2, True)
        xy = Value.const_struct([x, y])

        self.assertTrue(xy.is_const_struct())
        [x_, y_] = xy.operands
        self.assertEqual(x, x_)
        self.assertEqual(y, y_)
Example #3
0
    def testCreateStruct(self):
        ty = Type.int8()
        p = Type.structure([ty, ty], False)

        self.assertEqual('{ i8, i8 }', p.name)
        self.assertEqual(2, p.num_elements())

        elems = p.elements()
        t1 = elems[0]
        self.assertEqual('i8', t1.name)
        t2 = elems[1]
        self.assertEqual('i8', t2.name)
Example #4
0
    def testCreateStruct(self):
        ty = Type.int8()
        p = Type.structure([ty, ty], False)

        self.assertEqual('{ i8, i8 }', p.name)
        self.assertEqual(2, p.num_elements())

        elems = p.elements()
        t1 = elems[0]
        self.assertEqual('i8', t1.name)
        t2 = elems[1]
        self.assertEqual('i8', t2.name)