Search in sources :

Example 1 with ExpectedResults

use of org.ballerinalang.test.utils.debug.ExpectedResults in project ballerina by ballerina-lang.

the class VMDebuggerTest method testStepOver.

@Test(description = "Testing Step Over.")
public void testStepOver() {
    BreakPointDTO[] breakPoints = Util.createBreakNodeLocations(".", FILE, 3);
    List<DebugPoint> debugPoints = new ArrayList<>();
    debugPoints.add(Util.createDebugPoint(".", FILE, 3, STEP_OVER, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 5, STEP_OVER, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 6, STEP_OVER, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 8, STEP_OVER, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 9, STEP_OVER, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 10, RESUME, 1));
    ExpectedResults expRes = new ExpectedResults(debugPoints, 6);
    VMDebuggerUtil.startDebug("test-src/debugger/test-debug.bal", breakPoints, expRes);
}
Also used : BreakPointDTO(org.ballerinalang.util.debugger.dto.BreakPointDTO) DebugPoint(org.ballerinalang.test.utils.debug.DebugPoint) ArrayList(java.util.ArrayList) ExpectedResults(org.ballerinalang.test.utils.debug.ExpectedResults) Test(org.testng.annotations.Test)

Example 2 with ExpectedResults

use of org.ballerinalang.test.utils.debug.ExpectedResults in project ballerina by ballerina-lang.

the class VMDebuggerTest method testStepIn.

@Test(description = "Testing Step In.")
public void testStepIn() {
    BreakPointDTO[] breakPoints = Util.createBreakNodeLocations(".", FILE, 5, 8, 41);
    List<DebugPoint> debugPoints = new ArrayList<>();
    debugPoints.add(Util.createDebugPoint(".", FILE, 5, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 12, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 13, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 14, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 15, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 19, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 13, RESUME, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 8, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 41, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 25, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 26, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 28, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 29, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 35, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 36, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 42, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 43, STEP_IN, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 9, RESUME, 1));
    ExpectedResults expRes = new ExpectedResults(debugPoints, 18);
    VMDebuggerUtil.startDebug("test-src/debugger/test-debug.bal", breakPoints, expRes);
}
Also used : BreakPointDTO(org.ballerinalang.util.debugger.dto.BreakPointDTO) DebugPoint(org.ballerinalang.test.utils.debug.DebugPoint) ArrayList(java.util.ArrayList) ExpectedResults(org.ballerinalang.test.utils.debug.ExpectedResults) Test(org.testng.annotations.Test)

Example 3 with ExpectedResults

use of org.ballerinalang.test.utils.debug.ExpectedResults in project ballerina by ballerina-lang.

the class VMDebuggerTest method testResume.

@Test(description = "Testing Resume with break points.")
public void testResume() {
    BreakPointDTO[] breakPoints = Util.createBreakNodeLocations(".", FILE, 3, 16, 27, 28, 31, 33, 35, 41, 42, 43, 44, 45);
    List<DebugPoint> debugPoints = new ArrayList<>();
    debugPoints.add(Util.createDebugPoint(".", FILE, 3, RESUME, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 16, RESUME, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 41, RESUME, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 28, RESUME, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 35, RESUME, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 42, RESUME, 1));
    debugPoints.add(Util.createDebugPoint(".", FILE, 43, RESUME, 1));
    ExpectedResults expRes = new ExpectedResults(debugPoints, 7);
    VMDebuggerUtil.startDebug("test-src/debugger/test-debug.bal", breakPoints, expRes);
}
Also used : BreakPointDTO(org.ballerinalang.util.debugger.dto.BreakPointDTO) DebugPoint(org.ballerinalang.test.utils.debug.DebugPoint) ArrayList(java.util.ArrayList) ExpectedResults(org.ballerinalang.test.utils.debug.ExpectedResults) Test(org.testng.annotations.Test)

Example 4 with ExpectedResults

use of org.ballerinalang.test.utils.debug.ExpectedResults in project ballerina by ballerina-lang.

the class VMDebuggerTest method testWhileStatementResume.

@Test(description = "Testing while statement resume")
public void testWhileStatementResume() {
    BreakPointDTO[] breakPoints = Util.createBreakNodeLocations(".", "while-statement.bal", 5);
    List<DebugPoint> debugPoints = new ArrayList<>();
    debugPoints.add(Util.createDebugPoint(".", "while-statement.bal", 5, RESUME, 5));
    ExpectedResults expRes = new ExpectedResults(debugPoints, 5);
    VMDebuggerUtil.startDebug("test-src/debugger/while-statement.bal", breakPoints, expRes);
}
Also used : BreakPointDTO(org.ballerinalang.util.debugger.dto.BreakPointDTO) DebugPoint(org.ballerinalang.test.utils.debug.DebugPoint) ArrayList(java.util.ArrayList) ExpectedResults(org.ballerinalang.test.utils.debug.ExpectedResults) Test(org.testng.annotations.Test)

Example 5 with ExpectedResults

use of org.ballerinalang.test.utils.debug.ExpectedResults in project ballerina by ballerina-lang.

the class VMDebuggerTest method testNegativeBreakPoints.

@Test(description = "Testing Debugger with breakpoint in non executable and not reachable lines.")
public void testNegativeBreakPoints() {
    BreakPointDTO[] breakPoints = Util.createBreakNodeLocations(".", FILE, 4, 7, 51, 37);
    List<DebugPoint> debugPoints = new ArrayList<>();
    ExpectedResults expRes = new ExpectedResults(debugPoints, 0);
    VMDebuggerUtil.startDebug("test-src/debugger/test-debug.bal", breakPoints, expRes);
}
Also used : BreakPointDTO(org.ballerinalang.util.debugger.dto.BreakPointDTO) DebugPoint(org.ballerinalang.test.utils.debug.DebugPoint) ArrayList(java.util.ArrayList) ExpectedResults(org.ballerinalang.test.utils.debug.ExpectedResults) Test(org.testng.annotations.Test)

Aggregations

ArrayList (java.util.ArrayList)11 DebugPoint (org.ballerinalang.test.utils.debug.DebugPoint)11 ExpectedResults (org.ballerinalang.test.utils.debug.ExpectedResults)11 BreakPointDTO (org.ballerinalang.util.debugger.dto.BreakPointDTO)11 Test (org.testng.annotations.Test)11