Esempio n. 1
0
        public void SetSuccessor_cannot_be_called_twice()
        {
            var blockBuilder = new BasicBlockGraphBuilder().GetInitialBlockBuilder();

            Assert.That(() => blockBuilder.SetSuccessor(0), Throws.Nothing);
            Assert.That(blockBuilder.DefaultSuccessor, Is.EqualTo(0));
            Assert.That(() => blockBuilder.SetSuccessor(0), Throws.InvalidOperationException);
        }
Esempio n. 2
0
        public void Block_cannot_be_appended_to_after_setting_successor()
        {
            var blockBuilder = new BasicBlockGraphBuilder().GetInitialBlockBuilder();

            blockBuilder.SetSuccessor(0);

            blockBuilder.AppendInstruction(Opcode.Nop, 0, 0, 0);
            Assert.That(blockBuilder.Instructions, Is.Empty);
        }
Esempio n. 3
0
        public void SetSuccessor_does_nothing_if_return_exists()
        {
            var blockBuilder = new BasicBlockGraphBuilder().GetInitialBlockBuilder();

            blockBuilder.AppendInstruction(Opcode.Return, 0, 0, 0);

            Assert.That(() => blockBuilder.SetSuccessor(0), Throws.Nothing);
            Assert.That(blockBuilder.DefaultSuccessor, Is.EqualTo(-1));
        }