public void TerConstants() { var arch = new FakeArchitecture(); Program program = new Program( new SegmentMap(Address.Ptr32(0x10000)), arch, new DefaultPlatform(null, arch)); SetupPreStages(program); Constant r = Constant.Real32(3.0F); Constant i = Constant.Int32(1); Identifier x = new Identifier("x", PrimitiveType.Word32, null); Assignment ass = new Assignment(x, r); TypeVariable tvR = r.TypeVariable = program.TypeFactory.CreateTypeVariable(); TypeVariable tvI = i.TypeVariable = program.TypeFactory.CreateTypeVariable(); TypeVariable tvX = x.TypeVariable = program.TypeFactory.CreateTypeVariable(); program.TypeStore.TypeVariables.AddRange(new TypeVariable[] { tvR, tvI, tvX }); UnionType u = program.TypeFactory.CreateUnionType(null, null, new DataType[] { r.DataType, i.DataType }); tvR.OriginalDataType = r.DataType; tvI.OriginalDataType = i.DataType; tvX.OriginalDataType = x.DataType; tvR.DataType = u; tvI.DataType = u; tvX.DataType = u; ctn.RenameAllTypes(program.TypeStore); var ter = new TypedExpressionRewriter(program, null); Instruction instr = ter.TransformAssignment(ass); Assert.AreEqual("x.u0 = 3.0F", instr.ToString()); }