示例#1
0
        public void Test_StaticFlow_IsLoopMergePoint_1()
        {
            string programStr =
                "           mov     rax,        10     ;line 0         " + Environment.NewLine +
                "label1:                               ;line 1         " + Environment.NewLine +
                "           mov     rbx,        1      ;line 2         " + Environment.NewLine +
                "           dec     rax                ;line 3         " + Environment.NewLine +
                "           jnz     label1             ;line 4         " + Environment.NewLine +
                "           mov     rcx,        1      ;line 5         ";

            StaticFlow flow = new StaticFlow(new Tools());

            flow.Update(programStr, false);
            if (logToDisplay)
            {
                Console.WriteLine(flow);
            }

            {
                var(IsLoopMergePoint, LoopLineNumber) = flow.Is_Loop_Merge_Point(0);
                Assert.IsFalse(IsLoopMergePoint);
            }
            {
                var(IsLoopMergePoint, LoopLineNumber) = flow.Is_Loop_Merge_Point(1);
                Assert.IsTrue(IsLoopMergePoint);
                //Assert.IsFalse(v.BranchToExitLoop);
            }
            {
                var(IsLoopMergePoint, LoopLineNumber) = flow.Is_Loop_Merge_Point(2);
                Assert.IsFalse(IsLoopMergePoint);
            }
            {
                var(IsLoopMergePoint, LoopLineNumber) = flow.Is_Loop_Merge_Point(3);
                Assert.IsFalse(IsLoopMergePoint);
            }
            {
                var(IsLoopMergePoint, LoopLineNumber) = flow.Is_Loop_Merge_Point(4);
                Assert.IsFalse(IsLoopMergePoint);
            }
            {
                var(IsLoopMergePoint, LoopLineNumber) = flow.Is_Loop_Merge_Point(5);
                Assert.IsFalse(IsLoopMergePoint);
            }
        }