def test_constants(self): c = xpt.Constant("X", xpt.SimpleType(xpt.Type.Tags.uint32), 0xF000F000) i = xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff", constants=[c]) t = xpt.Typelib(interfaces=[i]) self.checkRoundtrip(t) # tack on some more constants i.constants.append( xpt.Constant("Y", xpt.SimpleType(xpt.Type.Tags.int16), -30000)) i.constants.append( xpt.Constant("Z", xpt.SimpleType(xpt.Type.Tags.uint16), 0xB0B0)) i.constants.append( xpt.Constant("A", xpt.SimpleType(xpt.Type.Tags.int32), -1000000)) self.checkRoundtrip(t)
def build_const(c): consts.append( xpt.Constant(c.name, get_type(c.basetype, ''), c.getValue()))