public void Appending_to_block_after_adding_return_does_nothing()
        {
            var blockBuilder = new BasicBlockGraphBuilder().GetInitialBlockBuilder();

            blockBuilder.AppendInstruction(Opcode.Return, 0, 0, 0);
            Assert.That(blockBuilder.Instructions, Has.Exactly(1).Items);

            blockBuilder.AppendInstruction(Opcode.Nop, 0, 0, 0);
            Assert.That(blockBuilder.Instructions, Has.Exactly(1).Items);
        }
        public void CreateSuccessorBlock_does_not_set_successor_if_return_exists()
        {
            var blockBuilder = new BasicBlockGraphBuilder().GetInitialBlockBuilder();

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

            Assert.That(blockBuilder.CreateSuccessorBlock(), Is.Not.Null);
            Assert.That(blockBuilder.DefaultSuccessor, Is.EqualTo(-1));
        }
        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);
        }
        public void SetAlternativeSuccessor_does_nothing_if_return_exists()
        {
            var blockBuilder = new BasicBlockGraphBuilder().GetInitialBlockBuilder();

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

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