Esempio n. 1
0
        public static IEnumerable <object[]> GetTestCases_Integration()
        {
            #region int Add(int, int)
            yield return(CreateTestCase(
                             "int Add(int, int)",
                             gen =>
            {
                gen.Emit(OpCodes.Ldarg_0);
                gen.Emit(OpCodes.Ldarg_1);
                gen.Emit(OpCodes.Add);
                gen.Emit(OpCodes.Ret);
            },
                             gen =>
            {
                gen.Emit(Inst.Ldarg_0());
                gen.Emit(Inst.Ldarg_1());
                gen.Emit(Inst.Add());
                gen.Emit(Inst.Ret());
            },
                             typeof(int),
                             new[] { typeof(int), typeof(int), }
                             ));

            #endregion

            #region int Sum(int[] array)
            yield return(CreateTestCase(
                             "int Sum(int[] array)",
                             gen =>
            {
                var retval = gen.DeclareLocal(typeof(int));
                var i = gen.DeclareLocal(typeof(int));
                var il_0000 = gen.DefineLabel();
                var il_0001 = gen.DefineLabel();
                var il_0002 = gen.DefineLabel();
                var il_0003 = gen.DefineLabel();
                var il_0004 = gen.DefineLabel();
                var il_0006 = gen.DefineLabel();
                var il_0007 = gen.DefineLabel();
                var il_0008 = gen.DefineLabel();
                var il_0009 = gen.DefineLabel();
                var il_000a = gen.DefineLabel();
                var il_000b = gen.DefineLabel();
                var il_000c = gen.DefineLabel();
                var il_000d = gen.DefineLabel();
                var il_000e = gen.DefineLabel();
                var il_000f = gen.DefineLabel();
                var il_0010 = gen.DefineLabel();
                var il_0011 = gen.DefineLabel();
                var il_0012 = gen.DefineLabel();
                var il_0013 = gen.DefineLabel();
                var il_0014 = gen.DefineLabel();
                var il_0016 = gen.DefineLabel();
                var il_0017 = gen.DefineLabel();
                gen.MarkLabel(il_0000); gen.Emit(OpCodes.Ldc_I4_0);
                gen.MarkLabel(il_0001); gen.Emit(OpCodes.Stloc, retval);
                gen.MarkLabel(il_0002); gen.Emit(OpCodes.Ldc_I4_0);
                gen.MarkLabel(il_0003); gen.Emit(OpCodes.Stloc, i);
                gen.MarkLabel(il_0004); gen.Emit(OpCodes.Br_S, il_0010);
                gen.MarkLabel(il_0006); gen.Emit(OpCodes.Ldloc, retval);
                gen.MarkLabel(il_0007); gen.Emit(OpCodes.Ldarg_0);
                gen.MarkLabel(il_0008); gen.Emit(OpCodes.Ldloc, i);
                gen.MarkLabel(il_0009); gen.Emit(OpCodes.Ldelem_I4);
                gen.MarkLabel(il_000a); gen.Emit(OpCodes.Add);
                gen.MarkLabel(il_000b); gen.Emit(OpCodes.Stloc, retval);
                gen.MarkLabel(il_000c); gen.Emit(OpCodes.Ldloc, i);
                gen.MarkLabel(il_000d); gen.Emit(OpCodes.Ldc_I4_1);
                gen.MarkLabel(il_000e); gen.Emit(OpCodes.Add);
                gen.MarkLabel(il_000f); gen.Emit(OpCodes.Stloc, i);
                gen.MarkLabel(il_0010); gen.Emit(OpCodes.Ldloc, i);
                gen.MarkLabel(il_0011); gen.Emit(OpCodes.Ldarg_0);
                gen.MarkLabel(il_0012); gen.Emit(OpCodes.Ldlen);
                gen.MarkLabel(il_0013); gen.Emit(OpCodes.Conv_I4);
                gen.MarkLabel(il_0014); gen.Emit(OpCodes.Blt_S, il_0006);
                gen.MarkLabel(il_0016); gen.Emit(OpCodes.Ldloc, retval);
                gen.MarkLabel(il_0017); gen.Emit(OpCodes.Ret);
            },
                             gen =>
            {
                var retval = gen.DeclareLocal(typeof(int));
                var i = gen.DeclareLocal(typeof(int));
                var il_0000 = new LabelBuilder("il_0000");
                var il_0001 = new LabelBuilder("il_0001");
                var il_0002 = new LabelBuilder("il_0002");
                var il_0003 = new LabelBuilder("il_0003");
                var il_0004 = new LabelBuilder("il_0004");
                var il_0006 = new LabelBuilder("il_0006");
                var il_0007 = new LabelBuilder("il_0007");
                var il_0008 = new LabelBuilder("il_0008");
                var il_0009 = new LabelBuilder("il_0009");
                var il_000a = new LabelBuilder("il_000a");
                var il_000b = new LabelBuilder("il_000b");
                var il_000c = new LabelBuilder("il_000c");
                var il_000d = new LabelBuilder("il_000d");
                var il_000e = new LabelBuilder("il_000e");
                var il_000f = new LabelBuilder("il_000f");
                var il_0010 = new LabelBuilder("il_0010");
                var il_0011 = new LabelBuilder("il_0011");
                var il_0012 = new LabelBuilder("il_0012");
                var il_0013 = new LabelBuilder("il_0013");
                var il_0014 = new LabelBuilder("il_0014");
                var il_0016 = new LabelBuilder("il_0016");
                var il_0017 = new LabelBuilder("il_0017");
                il_0000.MarkLabel(gen); gen.Emit(Inst.Ldc_I4_0());
                il_0001.MarkLabel(gen); gen.Emit(Inst.Stloc(retval));
                il_0002.MarkLabel(gen); gen.Emit(Inst.Ldc_I4_0());
                il_0003.MarkLabel(gen); gen.Emit(Inst.Stloc(i));
                il_0004.MarkLabel(gen); gen.Emit(Inst.Br_S(il_0010));
                il_0006.MarkLabel(gen); gen.Emit(Inst.Ldloc(retval));
                il_0007.MarkLabel(gen); gen.Emit(Inst.Ldarg_0());
                il_0008.MarkLabel(gen); gen.Emit(Inst.Ldloc(i));
                il_0009.MarkLabel(gen); gen.Emit(Inst.Ldelem_I4());
                il_000a.MarkLabel(gen); gen.Emit(Inst.Add());
                il_000b.MarkLabel(gen); gen.Emit(Inst.Stloc(retval));
                il_000c.MarkLabel(gen); gen.Emit(Inst.Ldloc(i));
                il_000d.MarkLabel(gen); gen.Emit(Inst.Ldc_I4_1());
                il_000e.MarkLabel(gen); gen.Emit(Inst.Add());
                il_000f.MarkLabel(gen); gen.Emit(Inst.Stloc(i));
                il_0010.MarkLabel(gen); gen.Emit(Inst.Ldloc(i));
                il_0011.MarkLabel(gen); gen.Emit(Inst.Ldarg_0());
                il_0012.MarkLabel(gen); gen.Emit(Inst.Ldlen());
                il_0013.MarkLabel(gen); gen.Emit(Inst.Conv_I4());
                il_0014.MarkLabel(gen); gen.Emit(Inst.Blt_S(il_0006));
                il_0016.MarkLabel(gen); gen.Emit(Inst.Ldloc(retval));
                il_0017.MarkLabel(gen); gen.Emit(Inst.Ret());
            },
                             typeof(int),
                             new[] { typeof(int[]), }
                             ));

            #endregion

            yield break;
        }
Esempio n. 2
0
        public static IEnumerable <object[]> GetTestCases_Basic()
        {
            yield return(CreateTestCase("nop",
                                        gen => gen.Emit(OpCodes.Nop),
                                        gen => gen.Emit(Inst.Nop())
                                        ));

            yield return(CreateTestCase("break",
                                        gen => gen.Emit(OpCodes.Break),
                                        gen => gen.Emit(Inst.Break())
                                        ));

            yield return(CreateTestCase("ldarg.0",
                                        gen => gen.Emit(OpCodes.Ldarg_0),
                                        gen => gen.Emit(Inst.Ldarg_0())
                                        ));

            yield return(CreateTestCase("ldarg.1",
                                        gen => gen.Emit(OpCodes.Ldarg_1),
                                        gen => gen.Emit(Inst.Ldarg_1())
                                        ));

            yield return(CreateTestCase("ldarg.2",
                                        gen => gen.Emit(OpCodes.Ldarg_2),
                                        gen => gen.Emit(Inst.Ldarg_2())
                                        ));

            yield return(CreateTestCase("ldarg.3",
                                        gen => gen.Emit(OpCodes.Ldarg_3),
                                        gen => gen.Emit(Inst.Ldarg_3())
                                        ));

            yield return(CreateTestCase("ldloc.0",
                                        gen => gen.Emit(OpCodes.Ldloc_0),
                                        gen => gen.Emit(Inst.Ldloc_0())
                                        ));

            yield return(CreateTestCase("ldloc.1",
                                        gen => gen.Emit(OpCodes.Ldloc_1),
                                        gen => gen.Emit(Inst.Ldloc_1())
                                        ));

            yield return(CreateTestCase("ldloc.2",
                                        gen => gen.Emit(OpCodes.Ldloc_2),
                                        gen => gen.Emit(Inst.Ldloc_2())
                                        ));

            yield return(CreateTestCase("ldloc.3",
                                        gen => gen.Emit(OpCodes.Ldloc_3),
                                        gen => gen.Emit(Inst.Ldloc_3())
                                        ));

            yield return(CreateTestCase("stloc.0",
                                        gen => gen.Emit(OpCodes.Stloc_0),
                                        gen => gen.Emit(Inst.Stloc_0())
                                        ));

            yield return(CreateTestCase("stloc.1",
                                        gen => gen.Emit(OpCodes.Stloc_1),
                                        gen => gen.Emit(Inst.Stloc_1())
                                        ));

            yield return(CreateTestCase("stloc.2",
                                        gen => gen.Emit(OpCodes.Stloc_2),
                                        gen => gen.Emit(Inst.Stloc_2())
                                        ));

            yield return(CreateTestCase("stloc.3",
                                        gen => gen.Emit(OpCodes.Stloc_3),
                                        gen => gen.Emit(Inst.Stloc_3())
                                        ));

            yield return(CreateTestCase("ldarg.s",
                                        gen => gen.Emit(OpCodes.Ldarg_S, byte.MaxValue),
                                        gen => gen.Emit(Inst.Ldarg_S(byte.MaxValue))
                                        ));

            yield return(CreateTestCase("ldarga.s",
                                        gen => gen.Emit(OpCodes.Ldarga_S, byte.MaxValue),
                                        gen => gen.Emit(Inst.Ldarga_S(byte.MaxValue))
                                        ));

            yield return(CreateTestCase("starg.s",
                                        gen => gen.Emit(OpCodes.Starg_S, byte.MaxValue),
                                        gen => gen.Emit(Inst.Starg_S(byte.MaxValue))
                                        ));

            yield return(CreateTestCase("ldloc.s",
                                        gen => gen.Emit(OpCodes.Ldloc_S, byte.MaxValue),
                                        gen => gen.Emit(Inst.Ldloc_S(byte.MaxValue))
                                        ));

            yield return(CreateTestCase("ldloca.s",
                                        gen => gen.Emit(OpCodes.Ldloca_S, byte.MaxValue),
                                        gen => gen.Emit(Inst.Ldloca_S(byte.MaxValue))
                                        ));

            yield return(CreateTestCase("stloc.s",
                                        gen => gen.Emit(OpCodes.Stloc_S, byte.MaxValue),
                                        gen => gen.Emit(Inst.Stloc_S(byte.MaxValue))
                                        ));

            yield return(CreateTestCase("ldnull",
                                        gen => gen.Emit(OpCodes.Ldnull),
                                        gen => gen.Emit(Inst.Ldnull())
                                        ));

            yield return(CreateTestCase("ldc.i4.m1",
                                        gen => gen.Emit(OpCodes.Ldc_I4_M1),
                                        gen => gen.Emit(Inst.Ldc_I4_M1())
                                        ));

            yield return(CreateTestCase("ldc.i4.0",
                                        gen => gen.Emit(OpCodes.Ldc_I4_0),
                                        gen => gen.Emit(Inst.Ldc_I4_0())
                                        ));

            yield return(CreateTestCase("ldc.i4.1",
                                        gen => gen.Emit(OpCodes.Ldc_I4_1),
                                        gen => gen.Emit(Inst.Ldc_I4_1())
                                        ));

            yield return(CreateTestCase("ldc.i4.2",
                                        gen => gen.Emit(OpCodes.Ldc_I4_2),
                                        gen => gen.Emit(Inst.Ldc_I4_2())
                                        ));

            yield return(CreateTestCase("ldc.i4.3",
                                        gen => gen.Emit(OpCodes.Ldc_I4_3),
                                        gen => gen.Emit(Inst.Ldc_I4_3())
                                        ));

            yield return(CreateTestCase("ldc.i4.4",
                                        gen => gen.Emit(OpCodes.Ldc_I4_4),
                                        gen => gen.Emit(Inst.Ldc_I4_4())
                                        ));

            yield return(CreateTestCase("ldc.i4.5",
                                        gen => gen.Emit(OpCodes.Ldc_I4_5),
                                        gen => gen.Emit(Inst.Ldc_I4_5())
                                        ));

            yield return(CreateTestCase("ldc.i4.6",
                                        gen => gen.Emit(OpCodes.Ldc_I4_6),
                                        gen => gen.Emit(Inst.Ldc_I4_6())
                                        ));

            yield return(CreateTestCase("ldc.i4.7",
                                        gen => gen.Emit(OpCodes.Ldc_I4_7),
                                        gen => gen.Emit(Inst.Ldc_I4_7())
                                        ));

            yield return(CreateTestCase("ldc.i4.8",
                                        gen => gen.Emit(OpCodes.Ldc_I4_8),
                                        gen => gen.Emit(Inst.Ldc_I4_8())
                                        ));

            yield return(CreateTestCase("ldc.i4.s",
                                        gen => gen.Emit(OpCodes.Ldc_I4_S, sbyte.MaxValue),
                                        gen => gen.Emit(Inst.Ldc_I4_S(sbyte.MaxValue))
                                        ));

            yield return(CreateTestCase("ldc.i4",
                                        gen => gen.Emit(OpCodes.Ldc_I4, int.MaxValue),
                                        gen => gen.Emit(Inst.Ldc_I4(int.MaxValue))
                                        ));

            yield return(CreateTestCase("ldc.i8",
                                        gen => gen.Emit(OpCodes.Ldc_I8, long.MaxValue),
                                        gen => gen.Emit(Inst.Ldc_I8(long.MaxValue))
                                        ));

            yield return(CreateTestCase("ldc.r4",
                                        gen => gen.Emit(OpCodes.Ldc_R4, float.MaxValue),
                                        gen => gen.Emit(Inst.Ldc_R4(float.MaxValue))
                                        ));

            yield return(CreateTestCase("ldc.r8",
                                        gen => gen.Emit(OpCodes.Ldc_R8, double.MaxValue),
                                        gen => gen.Emit(Inst.Ldc_R8(double.MaxValue))
                                        ));

            yield return(CreateTestCase("dup",
                                        gen => gen.Emit(OpCodes.Dup),
                                        gen => gen.Emit(Inst.Dup())
                                        ));

            yield return(CreateTestCase("pop",
                                        gen => gen.Emit(OpCodes.Pop),
                                        gen => gen.Emit(Inst.Pop())
                                        ));

            yield return(CreateTestCase("jmp",
                                        gen => gen.Emit(OpCodes.Jmp, MockType.MethodInfo),
                                        gen => gen.Emit(Inst.Jmp(MockType.MethodInfo))
                                        ));

            yield return(CreateTestCase("call",
                                        gen => gen.Emit(OpCodes.Call, MockType.MethodInfo),
                                        gen => gen.Emit(Inst.Call(MockType.MethodInfo))
                                        ));

            yield return(CreateTestCase("ret",
                                        gen => gen.Emit(OpCodes.Ret),
                                        gen => gen.Emit(Inst.Ret())
                                        ));

            yield return(CreateTestCase("ldind.i1",
                                        gen => gen.Emit(OpCodes.Ldind_I1),
                                        gen => gen.Emit(Inst.Ldind_I1())
                                        ));

            yield return(CreateTestCase("ldind.u1",
                                        gen => gen.Emit(OpCodes.Ldind_U1),
                                        gen => gen.Emit(Inst.Ldind_U1())
                                        ));

            yield return(CreateTestCase("ldind.i2",
                                        gen => gen.Emit(OpCodes.Ldind_I2),
                                        gen => gen.Emit(Inst.Ldind_I2())
                                        ));

            yield return(CreateTestCase("ldind.u2",
                                        gen => gen.Emit(OpCodes.Ldind_U2),
                                        gen => gen.Emit(Inst.Ldind_U2())
                                        ));

            yield return(CreateTestCase("ldind.i4",
                                        gen => gen.Emit(OpCodes.Ldind_I4),
                                        gen => gen.Emit(Inst.Ldind_I4())
                                        ));

            yield return(CreateTestCase("ldind.u4",
                                        gen => gen.Emit(OpCodes.Ldind_U4),
                                        gen => gen.Emit(Inst.Ldind_U4())
                                        ));

            yield return(CreateTestCase("ldind.i8",
                                        gen => gen.Emit(OpCodes.Ldind_I8),
                                        gen => gen.Emit(Inst.Ldind_I8())
                                        ));

            yield return(CreateTestCase("ldind.i",
                                        gen => gen.Emit(OpCodes.Ldind_I),
                                        gen => gen.Emit(Inst.Ldind_I())
                                        ));

            yield return(CreateTestCase("ldind.r4",
                                        gen => gen.Emit(OpCodes.Ldind_R4),
                                        gen => gen.Emit(Inst.Ldind_R4())
                                        ));

            yield return(CreateTestCase("ldind.r8",
                                        gen => gen.Emit(OpCodes.Ldind_R8),
                                        gen => gen.Emit(Inst.Ldind_R8())
                                        ));

            yield return(CreateTestCase("ldind.ref",
                                        gen => gen.Emit(OpCodes.Ldind_Ref),
                                        gen => gen.Emit(Inst.Ldind_Ref())
                                        ));

            yield return(CreateTestCase("stind.ref",
                                        gen => gen.Emit(OpCodes.Stind_Ref),
                                        gen => gen.Emit(Inst.Stind_Ref())
                                        ));

            yield return(CreateTestCase("stind.i1",
                                        gen => gen.Emit(OpCodes.Stind_I1),
                                        gen => gen.Emit(Inst.Stind_I1())
                                        ));

            yield return(CreateTestCase("stind.i2",
                                        gen => gen.Emit(OpCodes.Stind_I2),
                                        gen => gen.Emit(Inst.Stind_I2())
                                        ));

            yield return(CreateTestCase("stind.i4",
                                        gen => gen.Emit(OpCodes.Stind_I4),
                                        gen => gen.Emit(Inst.Stind_I4())
                                        ));

            yield return(CreateTestCase("stind.i8",
                                        gen => gen.Emit(OpCodes.Stind_I8),
                                        gen => gen.Emit(Inst.Stind_I8())
                                        ));

            yield return(CreateTestCase("stind.r4",
                                        gen => gen.Emit(OpCodes.Stind_R4),
                                        gen => gen.Emit(Inst.Stind_R4())
                                        ));

            yield return(CreateTestCase("stind.r8",
                                        gen => gen.Emit(OpCodes.Stind_R8),
                                        gen => gen.Emit(Inst.Stind_R8())
                                        ));

            yield return(CreateTestCase("add",
                                        gen => gen.Emit(OpCodes.Add),
                                        gen => gen.Emit(Inst.Add())
                                        ));

            yield return(CreateTestCase("sub",
                                        gen => gen.Emit(OpCodes.Sub),
                                        gen => gen.Emit(Inst.Sub())
                                        ));

            yield return(CreateTestCase("mul",
                                        gen => gen.Emit(OpCodes.Mul),
                                        gen => gen.Emit(Inst.Mul())
                                        ));

            yield return(CreateTestCase("div",
                                        gen => gen.Emit(OpCodes.Div),
                                        gen => gen.Emit(Inst.Div())
                                        ));

            yield return(CreateTestCase("div.un",
                                        gen => gen.Emit(OpCodes.Div_Un),
                                        gen => gen.Emit(Inst.Div_Un())
                                        ));

            yield return(CreateTestCase("rem",
                                        gen => gen.Emit(OpCodes.Rem),
                                        gen => gen.Emit(Inst.Rem())
                                        ));

            yield return(CreateTestCase("rem.un",
                                        gen => gen.Emit(OpCodes.Rem_Un),
                                        gen => gen.Emit(Inst.Rem_Un())
                                        ));

            yield return(CreateTestCase("and",
                                        gen => gen.Emit(OpCodes.And),
                                        gen => gen.Emit(Inst.And())
                                        ));

            yield return(CreateTestCase("or",
                                        gen => gen.Emit(OpCodes.Or),
                                        gen => gen.Emit(Inst.Or())
                                        ));

            yield return(CreateTestCase("xor",
                                        gen => gen.Emit(OpCodes.Xor),
                                        gen => gen.Emit(Inst.Xor())
                                        ));

            yield return(CreateTestCase("shl",
                                        gen => gen.Emit(OpCodes.Shl),
                                        gen => gen.Emit(Inst.Shl())
                                        ));

            yield return(CreateTestCase("shr",
                                        gen => gen.Emit(OpCodes.Shr),
                                        gen => gen.Emit(Inst.Shr())
                                        ));

            yield return(CreateTestCase("shr.un",
                                        gen => gen.Emit(OpCodes.Shr_Un),
                                        gen => gen.Emit(Inst.Shr_Un())
                                        ));

            yield return(CreateTestCase("neg",
                                        gen => gen.Emit(OpCodes.Neg),
                                        gen => gen.Emit(Inst.Neg())
                                        ));

            yield return(CreateTestCase("not",
                                        gen => gen.Emit(OpCodes.Not),
                                        gen => gen.Emit(Inst.Not())
                                        ));

            yield return(CreateTestCase("conv.i1",
                                        gen => gen.Emit(OpCodes.Conv_I1),
                                        gen => gen.Emit(Inst.Conv_I1())
                                        ));

            yield return(CreateTestCase("conv.i2",
                                        gen => gen.Emit(OpCodes.Conv_I2),
                                        gen => gen.Emit(Inst.Conv_I2())
                                        ));

            yield return(CreateTestCase("conv.i4",
                                        gen => gen.Emit(OpCodes.Conv_I4),
                                        gen => gen.Emit(Inst.Conv_I4())
                                        ));

            yield return(CreateTestCase("conv.i8",
                                        gen => gen.Emit(OpCodes.Conv_I8),
                                        gen => gen.Emit(Inst.Conv_I8())
                                        ));

            yield return(CreateTestCase("conv.r4",
                                        gen => gen.Emit(OpCodes.Conv_R4),
                                        gen => gen.Emit(Inst.Conv_R4())
                                        ));

            yield return(CreateTestCase("conv.r8",
                                        gen => gen.Emit(OpCodes.Conv_R8),
                                        gen => gen.Emit(Inst.Conv_R8())
                                        ));

            yield return(CreateTestCase("conv.u4",
                                        gen => gen.Emit(OpCodes.Conv_U4),
                                        gen => gen.Emit(Inst.Conv_U4())
                                        ));

            yield return(CreateTestCase("conv.u8",
                                        gen => gen.Emit(OpCodes.Conv_U8),
                                        gen => gen.Emit(Inst.Conv_U8())
                                        ));

            yield return(CreateTestCase("callvirt",
                                        gen => gen.Emit(OpCodes.Callvirt, MockType.MethodInfo),
                                        gen => gen.Emit(Inst.Callvirt(MockType.MethodInfo))
                                        ));

            yield return(CreateTestCase("cpobj",
                                        gen => gen.Emit(OpCodes.Cpobj, MockType.Type),
                                        gen => gen.Emit(Inst.Cpobj(MockType.Type))
                                        ));

            yield return(CreateTestCase("ldobj",
                                        gen => gen.Emit(OpCodes.Ldobj, MockType.Type),
                                        gen => gen.Emit(Inst.Ldobj(MockType.Type))
                                        ));

            yield return(CreateTestCase("ldstr",
                                        gen => gen.Emit(OpCodes.Ldstr, "foobar"),
                                        gen => gen.Emit(Inst.Ldstr("foobar"))
                                        ));

            yield return(CreateTestCase("newobj",
                                        gen => gen.Emit(OpCodes.Newobj, MockType.ConstructorInfo),
                                        gen => gen.Emit(Inst.Newobj(MockType.ConstructorInfo))
                                        ));

            yield return(CreateTestCase("castclass",
                                        gen => gen.Emit(OpCodes.Castclass, MockType.Type),
                                        gen => gen.Emit(Inst.Castclass(MockType.Type))
                                        ));

            yield return(CreateTestCase("isinst",
                                        gen => gen.Emit(OpCodes.Isinst, MockType.Type),
                                        gen => gen.Emit(Inst.Isinst(MockType.Type))
                                        ));

            yield return(CreateTestCase("conv.r.un",
                                        gen => gen.Emit(OpCodes.Conv_R_Un),
                                        gen => gen.Emit(Inst.Conv_R_Un())
                                        ));

            yield return(CreateTestCase("unbox",
                                        gen => gen.Emit(OpCodes.Unbox, MockType.Type),
                                        gen => gen.Emit(Inst.Unbox(MockType.Type))
                                        ));

            yield return(CreateTestCase("throw",
                                        gen => gen.Emit(OpCodes.Throw),
                                        gen => gen.Emit(Inst.Throw())
                                        ));

            yield return(CreateTestCase("ldfld",
                                        gen => gen.Emit(OpCodes.Ldfld, MockType.InstanceFieldInfo),
                                        gen => gen.Emit(Inst.Ldfld(MockType.InstanceFieldInfo))
                                        ));

            yield return(CreateTestCase("ldflda",
                                        gen => gen.Emit(OpCodes.Ldflda, MockType.InstanceFieldInfo),
                                        gen => gen.Emit(Inst.Ldflda(MockType.InstanceFieldInfo))
                                        ));

            yield return(CreateTestCase("stfld",
                                        gen => gen.Emit(OpCodes.Stfld, MockType.InstanceFieldInfo),
                                        gen => gen.Emit(Inst.Stfld(MockType.InstanceFieldInfo))
                                        ));

            yield return(CreateTestCase("ldsfld",
                                        gen => gen.Emit(OpCodes.Ldsfld, MockType.StaticFieldInfo),
                                        gen => gen.Emit(Inst.Ldsfld(MockType.StaticFieldInfo))
                                        ));

            yield return(CreateTestCase("ldsflda",
                                        gen => gen.Emit(OpCodes.Ldsflda, MockType.StaticFieldInfo),
                                        gen => gen.Emit(Inst.Ldsflda(MockType.StaticFieldInfo))
                                        ));

            yield return(CreateTestCase("stsfld",
                                        gen => gen.Emit(OpCodes.Stsfld, MockType.StaticFieldInfo),
                                        gen => gen.Emit(Inst.Stsfld(MockType.StaticFieldInfo))
                                        ));

            yield return(CreateTestCase("stobj",
                                        gen => gen.Emit(OpCodes.Stobj, MockType.Type),
                                        gen => gen.Emit(Inst.Stobj(MockType.Type))
                                        ));

            yield return(CreateTestCase("conv.ovf.i1.un",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_I1_Un),
                                        gen => gen.Emit(Inst.Conv_Ovf_I1_Un())
                                        ));

            yield return(CreateTestCase("conv.ovf.i2.un",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_I2_Un),
                                        gen => gen.Emit(Inst.Conv_Ovf_I2_Un())
                                        ));

            yield return(CreateTestCase("conv.ovf.i4.un",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_I4_Un),
                                        gen => gen.Emit(Inst.Conv_Ovf_I4_Un())
                                        ));

            yield return(CreateTestCase("conv.ovf.i8.un",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_I8_Un),
                                        gen => gen.Emit(Inst.Conv_Ovf_I8_Un())
                                        ));

            yield return(CreateTestCase("conv.ovf.u1.un",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_U1_Un),
                                        gen => gen.Emit(Inst.Conv_Ovf_U1_Un())
                                        ));

            yield return(CreateTestCase("conv.ovf.u2.un",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_U2_Un),
                                        gen => gen.Emit(Inst.Conv_Ovf_U2_Un())
                                        ));

            yield return(CreateTestCase("conv.ovf.u4.un",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_U4_Un),
                                        gen => gen.Emit(Inst.Conv_Ovf_U4_Un())
                                        ));

            yield return(CreateTestCase("conv.ovf.u8.un",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_U8_Un),
                                        gen => gen.Emit(Inst.Conv_Ovf_U8_Un())
                                        ));

            yield return(CreateTestCase("conv.ovf.i.un",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_I_Un),
                                        gen => gen.Emit(Inst.Conv_Ovf_I_Un())
                                        ));

            yield return(CreateTestCase("conv.ovf.u.un",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_U_Un),
                                        gen => gen.Emit(Inst.Conv_Ovf_U_Un())
                                        ));

            yield return(CreateTestCase("box",
                                        gen => gen.Emit(OpCodes.Box, MockType.Type),
                                        gen => gen.Emit(Inst.Box(MockType.Type))
                                        ));

            yield return(CreateTestCase("newarr",
                                        gen => gen.Emit(OpCodes.Newarr, MockType.Type),
                                        gen => gen.Emit(Inst.Newarr(MockType.Type))
                                        ));

            yield return(CreateTestCase("ldlen",
                                        gen => gen.Emit(OpCodes.Ldlen),
                                        gen => gen.Emit(Inst.Ldlen())
                                        ));

            yield return(CreateTestCase("ldelema",
                                        gen => gen.Emit(OpCodes.Ldelema, MockType.Type),
                                        gen => gen.Emit(Inst.Ldelema(MockType.Type))
                                        ));

            yield return(CreateTestCase("ldelem.i1",
                                        gen => gen.Emit(OpCodes.Ldelem_I1),
                                        gen => gen.Emit(Inst.Ldelem_I1())
                                        ));

            yield return(CreateTestCase("ldelem.u1",
                                        gen => gen.Emit(OpCodes.Ldelem_U1),
                                        gen => gen.Emit(Inst.Ldelem_U1())
                                        ));

            yield return(CreateTestCase("ldelem.i2",
                                        gen => gen.Emit(OpCodes.Ldelem_I2),
                                        gen => gen.Emit(Inst.Ldelem_I2())
                                        ));

            yield return(CreateTestCase("ldelem.u2",
                                        gen => gen.Emit(OpCodes.Ldelem_U2),
                                        gen => gen.Emit(Inst.Ldelem_U2())
                                        ));

            yield return(CreateTestCase("ldelem.i4",
                                        gen => gen.Emit(OpCodes.Ldelem_I4),
                                        gen => gen.Emit(Inst.Ldelem_I4())
                                        ));

            yield return(CreateTestCase("ldelem.u4",
                                        gen => gen.Emit(OpCodes.Ldelem_U4),
                                        gen => gen.Emit(Inst.Ldelem_U4())
                                        ));

            yield return(CreateTestCase("ldelem.i8",
                                        gen => gen.Emit(OpCodes.Ldelem_I8),
                                        gen => gen.Emit(Inst.Ldelem_I8())
                                        ));

            yield return(CreateTestCase("ldelem.i",
                                        gen => gen.Emit(OpCodes.Ldelem_I),
                                        gen => gen.Emit(Inst.Ldelem_I())
                                        ));

            yield return(CreateTestCase("ldelem.r4",
                                        gen => gen.Emit(OpCodes.Ldelem_R4),
                                        gen => gen.Emit(Inst.Ldelem_R4())
                                        ));

            yield return(CreateTestCase("ldelem.r8",
                                        gen => gen.Emit(OpCodes.Ldelem_R8),
                                        gen => gen.Emit(Inst.Ldelem_R8())
                                        ));

            yield return(CreateTestCase("ldelem.ref",
                                        gen => gen.Emit(OpCodes.Ldelem_Ref),
                                        gen => gen.Emit(Inst.Ldelem_Ref())
                                        ));

            yield return(CreateTestCase("stelem.i",
                                        gen => gen.Emit(OpCodes.Stelem_I),
                                        gen => gen.Emit(Inst.Stelem_I())
                                        ));

            yield return(CreateTestCase("stelem.i1",
                                        gen => gen.Emit(OpCodes.Stelem_I1),
                                        gen => gen.Emit(Inst.Stelem_I1())
                                        ));

            yield return(CreateTestCase("stelem.i2",
                                        gen => gen.Emit(OpCodes.Stelem_I2),
                                        gen => gen.Emit(Inst.Stelem_I2())
                                        ));

            yield return(CreateTestCase("stelem.i4",
                                        gen => gen.Emit(OpCodes.Stelem_I4),
                                        gen => gen.Emit(Inst.Stelem_I4())
                                        ));

            yield return(CreateTestCase("stelem.i8",
                                        gen => gen.Emit(OpCodes.Stelem_I8),
                                        gen => gen.Emit(Inst.Stelem_I8())
                                        ));

            yield return(CreateTestCase("stelem.r4",
                                        gen => gen.Emit(OpCodes.Stelem_R4),
                                        gen => gen.Emit(Inst.Stelem_R4())
                                        ));

            yield return(CreateTestCase("stelem.r8",
                                        gen => gen.Emit(OpCodes.Stelem_R8),
                                        gen => gen.Emit(Inst.Stelem_R8())
                                        ));

            yield return(CreateTestCase("stelem.ref",
                                        gen => gen.Emit(OpCodes.Stelem_Ref),
                                        gen => gen.Emit(Inst.Stelem_Ref())
                                        ));

            yield return(CreateTestCase("ldelem",
                                        gen => gen.Emit(OpCodes.Ldelem, MockType.Type),
                                        gen => gen.Emit(Inst.Ldelem(MockType.Type))
                                        ));

            yield return(CreateTestCase("stelem",
                                        gen => gen.Emit(OpCodes.Stelem, MockType.Type),
                                        gen => gen.Emit(Inst.Stelem(MockType.Type))
                                        ));

            yield return(CreateTestCase("unbox.any",
                                        gen => gen.Emit(OpCodes.Unbox_Any, MockType.Type),
                                        gen => gen.Emit(Inst.Unbox_Any(MockType.Type))
                                        ));

            yield return(CreateTestCase("conv.ovf.i1",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_I1),
                                        gen => gen.Emit(Inst.Conv_Ovf_I1())
                                        ));

            yield return(CreateTestCase("conv.ovf.u1",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_U1),
                                        gen => gen.Emit(Inst.Conv_Ovf_U1())
                                        ));

            yield return(CreateTestCase("conv.ovf.i2",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_I2),
                                        gen => gen.Emit(Inst.Conv_Ovf_I2())
                                        ));

            yield return(CreateTestCase("conv.ovf.u2",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_U2),
                                        gen => gen.Emit(Inst.Conv_Ovf_U2())
                                        ));

            yield return(CreateTestCase("conv.ovf.i4",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_I4),
                                        gen => gen.Emit(Inst.Conv_Ovf_I4())
                                        ));

            yield return(CreateTestCase("conv.ovf.u4",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_U4),
                                        gen => gen.Emit(Inst.Conv_Ovf_U4())
                                        ));

            yield return(CreateTestCase("conv.ovf.i8",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_I8),
                                        gen => gen.Emit(Inst.Conv_Ovf_I8())
                                        ));

            yield return(CreateTestCase("conv.ovf.u8",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_U8),
                                        gen => gen.Emit(Inst.Conv_Ovf_U8())
                                        ));

            yield return(CreateTestCase("refanyval",
                                        gen => gen.Emit(OpCodes.Refanyval, MockType.Type),
                                        gen => gen.Emit(Inst.Refanyval(MockType.Type))
                                        ));

            yield return(CreateTestCase("ckfinite",
                                        gen => gen.Emit(OpCodes.Ckfinite),
                                        gen => gen.Emit(Inst.Ckfinite())
                                        ));

            yield return(CreateTestCase("mkrefany",
                                        gen => gen.Emit(OpCodes.Mkrefany, MockType.Type),
                                        gen => gen.Emit(Inst.Mkrefany(MockType.Type))
                                        ));

            yield return(CreateTestCase("conv.u2",
                                        gen => gen.Emit(OpCodes.Conv_U2),
                                        gen => gen.Emit(Inst.Conv_U2())
                                        ));

            yield return(CreateTestCase("conv.u1",
                                        gen => gen.Emit(OpCodes.Conv_U1),
                                        gen => gen.Emit(Inst.Conv_U1())
                                        ));

            yield return(CreateTestCase("conv.i",
                                        gen => gen.Emit(OpCodes.Conv_I),
                                        gen => gen.Emit(Inst.Conv_I())
                                        ));

            yield return(CreateTestCase("conv.ovf.i",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_I),
                                        gen => gen.Emit(Inst.Conv_Ovf_I())
                                        ));

            yield return(CreateTestCase("conv.ovf.u",
                                        gen => gen.Emit(OpCodes.Conv_Ovf_U),
                                        gen => gen.Emit(Inst.Conv_Ovf_U())
                                        ));

            yield return(CreateTestCase("add.ovf",
                                        gen => gen.Emit(OpCodes.Add_Ovf),
                                        gen => gen.Emit(Inst.Add_Ovf())
                                        ));

            yield return(CreateTestCase("add.ovf.un",
                                        gen => gen.Emit(OpCodes.Add_Ovf_Un),
                                        gen => gen.Emit(Inst.Add_Ovf_Un())
                                        ));

            yield return(CreateTestCase("mul.ovf",
                                        gen => gen.Emit(OpCodes.Mul_Ovf),
                                        gen => gen.Emit(Inst.Mul_Ovf())
                                        ));

            yield return(CreateTestCase("mul.ovf.un",
                                        gen => gen.Emit(OpCodes.Mul_Ovf_Un),
                                        gen => gen.Emit(Inst.Mul_Ovf_Un())
                                        ));

            yield return(CreateTestCase("sub.ovf",
                                        gen => gen.Emit(OpCodes.Sub_Ovf),
                                        gen => gen.Emit(Inst.Sub_Ovf())
                                        ));

            yield return(CreateTestCase("sub.ovf.un",
                                        gen => gen.Emit(OpCodes.Sub_Ovf_Un),
                                        gen => gen.Emit(Inst.Sub_Ovf_Un())
                                        ));

            yield return(CreateTestCase("endfinally",
                                        gen => gen.Emit(OpCodes.Endfinally),
                                        gen => gen.Emit(Inst.Endfinally())
                                        ));

            yield return(CreateTestCase("stind.i",
                                        gen => gen.Emit(OpCodes.Stind_I),
                                        gen => gen.Emit(Inst.Stind_I())
                                        ));

            yield return(CreateTestCase("conv.u",
                                        gen => gen.Emit(OpCodes.Conv_U),
                                        gen => gen.Emit(Inst.Conv_U())
                                        ));

            yield return(CreateTestCase("arglist",
                                        gen => gen.Emit(OpCodes.Arglist),
                                        gen => gen.Emit(Inst.Arglist())
                                        ));

            yield return(CreateTestCase("ceq",
                                        gen => gen.Emit(OpCodes.Ceq),
                                        gen => gen.Emit(Inst.Ceq())
                                        ));

            yield return(CreateTestCase("cgt",
                                        gen => gen.Emit(OpCodes.Cgt),
                                        gen => gen.Emit(Inst.Cgt())
                                        ));

            yield return(CreateTestCase("cgt.un",
                                        gen => gen.Emit(OpCodes.Cgt_Un),
                                        gen => gen.Emit(Inst.Cgt_Un())
                                        ));

            yield return(CreateTestCase("clt",
                                        gen => gen.Emit(OpCodes.Clt),
                                        gen => gen.Emit(Inst.Clt())
                                        ));

            yield return(CreateTestCase("clt.un",
                                        gen => gen.Emit(OpCodes.Clt_Un),
                                        gen => gen.Emit(Inst.Clt_Un())
                                        ));

            yield return(CreateTestCase("ldftn",
                                        gen => gen.Emit(OpCodes.Ldftn, MockType.MethodInfo),
                                        gen => gen.Emit(Inst.Ldftn(MockType.MethodInfo))
                                        ));

            yield return(CreateTestCase("ldvirtftn",
                                        gen => gen.Emit(OpCodes.Ldvirtftn, MockType.MethodInfo),
                                        gen => gen.Emit(Inst.Ldvirtftn(MockType.MethodInfo))
                                        ));

            yield return(CreateTestCase("ldarg",
                                        gen => gen.Emit(OpCodes.Ldarg, unchecked ((short)ushort.MaxValue)),
                                        gen => gen.Emit(Inst.Ldarg(ushort.MaxValue))
                                        ));

            yield return(CreateTestCase("ldarga",
                                        gen => gen.Emit(OpCodes.Ldarga, unchecked ((short)ushort.MaxValue)),
                                        gen => gen.Emit(Inst.Ldarga(ushort.MaxValue))
                                        ));

            yield return(CreateTestCase("starg",
                                        gen => gen.Emit(OpCodes.Starg, unchecked ((short)ushort.MaxValue)),
                                        gen => gen.Emit(Inst.Starg(ushort.MaxValue))
                                        ));

            yield return(CreateTestCase("ldloc",
                                        gen => gen.Emit(OpCodes.Ldloc, unchecked ((short)ushort.MaxValue)),
                                        gen => gen.Emit(Inst.Ldloc(ushort.MaxValue))
                                        ));

            yield return(CreateTestCase("ldloca",
                                        gen => gen.Emit(OpCodes.Ldloca, unchecked ((short)ushort.MaxValue)),
                                        gen => gen.Emit(Inst.Ldloca(ushort.MaxValue))
                                        ));

            yield return(CreateTestCase("stloc",
                                        gen => gen.Emit(OpCodes.Stloc, unchecked ((short)ushort.MaxValue)),
                                        gen => gen.Emit(Inst.Stloc(ushort.MaxValue))
                                        ));

            yield return(CreateTestCase("localloc",
                                        gen => gen.Emit(OpCodes.Localloc),
                                        gen => gen.Emit(Inst.Localloc())
                                        ));

            yield return(CreateTestCase("endfilter",
                                        gen => gen.Emit(OpCodes.Endfilter),
                                        gen => gen.Emit(Inst.Endfilter())
                                        ));

            yield return(CreateTestCase("unaligned.",
                                        gen => gen.Emit(OpCodes.Unaligned, byte.MaxValue),
                                        gen => gen.Emit(Inst.Unaligned(byte.MaxValue))
                                        ));

            yield return(CreateTestCase("volatile.",
                                        gen => gen.Emit(OpCodes.Volatile),
                                        gen => gen.Emit(Inst.Volatile())
                                        ));

            yield return(CreateTestCase("tail.",
                                        gen => gen.Emit(OpCodes.Tailcall),
                                        gen => gen.Emit(Inst.Tailcall())
                                        ));

            yield return(CreateTestCase("initobj",
                                        gen => gen.Emit(OpCodes.Initobj, MockType.Type),
                                        gen => gen.Emit(Inst.Initobj(MockType.Type))
                                        ));

            yield return(CreateTestCase("constrained.",
                                        gen => gen.Emit(OpCodes.Constrained, MockType.Type),
                                        gen => gen.Emit(Inst.Constrained(MockType.Type))
                                        ));

            yield return(CreateTestCase("cpblk",
                                        gen => gen.Emit(OpCodes.Cpblk),
                                        gen => gen.Emit(Inst.Cpblk())
                                        ));

            yield return(CreateTestCase("initblk",
                                        gen => gen.Emit(OpCodes.Initblk),
                                        gen => gen.Emit(Inst.Initblk())
                                        ));

            yield return(CreateTestCase("rethrow",
                                        gen => gen.Emit(OpCodes.Rethrow),
                                        gen => gen.Emit(Inst.Rethrow())
                                        ));

            yield return(CreateTestCase("sizeof",
                                        gen => gen.Emit(OpCodes.Sizeof, MockType.Type),
                                        gen => gen.Emit(Inst.Sizeof(MockType.Type))
                                        ));

            yield return(CreateTestCase("refanytype",
                                        gen => gen.Emit(OpCodes.Refanytype),
                                        gen => gen.Emit(Inst.Refanytype())
                                        ));

            yield return(CreateTestCase("readonly.",
                                        gen => gen.Emit(OpCodes.Readonly),
                                        gen => gen.Emit(Inst.Readonly())
                                        ));

            yield break;
        }