AsmResolver.Tests.Native.X86SizeComputationTests.TestSizeComputation C# (CSharp) Method

TestSizeComputation() private static method

private static TestSizeComputation ( byte opcodes ) : void
opcodes byte
return void
        private static void TestSizeComputation(byte[] opcodes)
        {
            var reader = new MemoryStreamReader(opcodes);
            var disassembler = new X86Disassembler(reader);

            while (reader.Position < reader.Length)
            {
                var instruction = disassembler.ReadNextInstruction();

                var expectedSize = reader.Position - instruction.Offset;
                var computeSize = instruction.ComputeSize();

                if (expectedSize != computeSize)
                    Assert.Fail("The instruction {0} has size {1}, but {2} was computed.", instruction, expectedSize,
                        computeSize);
            }
        }