コード例 #1
0
        public void CompressLocals()
        {
            var rand = new Random();
            // Generate one hundred local entries. Create a compressed function body
            // from them as well as an uncompressed function body. Then check that they
            // declare the same locals.
            int testCount = 100;

            for (int i = 0; i < testCount; i++)
            {
                var localEntries = GenerateLocalEntries(rand, rand.Next(50), 10);
                var compressed   = new FunctionBody(localEntries, Enumerable.Empty <Instruction>());
                compressed.CompressLocalEntries();
                var uncompressed = new FunctionBody(localEntries, Enumerable.Empty <Instruction>());
                AssertEquivalentLocals(compressed, uncompressed);
            }
        }