<commit_before>using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
using HarmonyLib;
using HarmonyLibTests.Assets;
using NUnit.Framework;

namespace HarmonyLibTests.IL
{
	[TestFixture]
	public class TestMethodBodyReader
	{
		[Test]
		public void CanGetInstructionsWithNoILGenerator()
		{
			var method = typeof(Class12).GetMethod(nameof(Class12.FizzBuzz));
			var instrsNoGen = MethodBodyReader.GetInstructions(generator: null, method);

			var dynamicMethod = DynamicTools.CreateDynamicMethod(method, "_Patch");
			var instrsHasGen = MethodBodyReader.GetInstructions(dynamicMethod.GetILGenerator(), method);

			Assert.AreEqual(instrsNoGen.Count, instrsHasGen.Count);
			for (var i = 0; i < instrsNoGen.Count; i++)
			{
				var instrNoGen = instrsNoGen[i];
				var instrHasGen = instrsHasGen[i];
				Assert.AreEqual(instrNoGen.offset, instrHasGen.offset, "offset @ {0} ({1})", i, instrNoGen);
				Assert.AreEqual(instrNoGen.opcode, instrHasGen.opcode, "opcode @ {0} ({1})", i, instrNoGen);
				AssertAreEqual(instrNoGen.operand, instrHasGen.operand, "operand", i, instrNoGen);
				CollectionAssert.AreEqual(instrNoGen.labels, instrHasGen.labels, "labels @ {0}", i);
				CollectionAssert.AreEqual(instrNoGen.blocks, instrHasGen.blocks, "blocks @ {0}", i);
				AssertAreEqual(instrNoGen.operand, instrHasGen.operand, "argument", i, instrNoGen);

				// The only difference between w/o gen and w/ gen is this:
				var operandType = instrNoGen.opcode.OperandType;<commit_msg>Fix copy&paste error in MethodBodyReader unit test<commit_after>using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
using HarmonyLib;
using HarmonyLibTests.Assets;
using NUnit.Framework;

namespace HarmonyLibTests.IL
{
	[TestFixture]
	public class TestMethodBodyReader
	{
		[Test]
		public void CanGetInstructionsWithNoILGenerator()
		{
			var method = typeof(Class12).GetMethod(nameof(Class12.FizzBuzz));
			var instrsNoGen = MethodBodyReader.GetInstructions(generator: null, method);

			var dynamicMethod = DynamicTools.CreateDynamicMethod(method, "_Patch");
			var instrsHasGen = MethodBodyReader.GetInstructions(dynamicMethod.GetILGenerator(), method);

			Assert.AreEqual(instrsNoGen.Count, instrsHasGen.Count);
			for (var i = 0; i < instrsNoGen.Count; i++)
			{
				var instrNoGen = instrsNoGen[i];
				var instrHasGen = instrsHasGen[i];
				Assert.AreEqual(instrNoGen.offset, instrHasGen.offset, "offset @ {0} ({1})", i, instrNoGen);
				Assert.AreEqual(instrNoGen.opcode, instrHasGen.opcode, "opcode @ {0} ({1})", i, instrNoGen);
				AssertAreEqual(instrNoGen.operand, instrHasGen.operand, "operand", i, instrNoGen);
				CollectionAssert.AreEqual(instrNoGen.labels, instrHasGen.labels, "labels @ {0}", i);
				CollectionAssert.AreEqual(instrNoGen.blocks, instrHasGen.blocks, "blocks @ {0}", i);
				AssertAreEqual(instrNoGen.argument, instrHasGen.argument, "argument", i, instrNoGen);

				// The only difference between w/o gen and w/ gen is this:
				var operandType = instrNoGen.opcode.OperandType;
{'fraction_non_alphanumeric': 0.11936862874054588, 'fraction_numerical': 0.007234462347911871, 'mean_word_length': 5.486140724946695, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '236034', 'n_tokens_mistral': 1076, 'n_tokens_neox': 979, 'n_words': 207}