예제 #1
0
        private void CompareSections(ModuleMetadata left, ModuleMetadata right)
        {
            Assert.AreEqual(left.Sections.Count, right.Sections.Count);
            for (var i = 0; i < left.Sections.Count; i++)
            {
                Assert.AreEqual(left.Sections[i].Id, right.Sections[i].Id);
            }

            var lsignatures = left.GetSection <SignaturesSection>();
            var rsignatures = right.GetSection <SignaturesSection>();

            Assert.AreEqual(lsignatures.Signatures.Count, rsignatures.Signatures.Count, lsignatures.Id);

            var lbodies = left.GetSection <FunctionBodiesSection>();
            var rbodies = right.GetSection <FunctionBodiesSection>();

            Assert.AreEqual(lbodies.Bodies.Count, rbodies.Bodies.Count, lbodies.Id);
            for (var i = 0; i < lbodies.Bodies.Count; i++)
            {
                var lfunctionBody = lbodies.Bodies[i].FunctionBody;
                var rfunctionBody = rbodies.Bodies[i].FunctionBody;
                Assert.AreEqual(lfunctionBody.Ast.Length, rfunctionBody.Ast.Length);
                Assert.AreEqual(lfunctionBody.Locals.Count, rfunctionBody.Locals.Count);
            }
        }