Commit bf35f666 authored by Mihai Herda's avatar Mihai Herda
Browse files

Merge branch 'master' of git.scc.kit.edu:py8074/dibugger

parents 119d9aa3 891d7a02
......@@ -12,6 +12,7 @@ import java.awt.*;
* process work.
*/
public class ErrorPopUp extends DIbuggerPopUp {
private static final long serialVersionUID = -7022730135662583205L;
private MainInterface mainInterface;
......
......@@ -17,6 +17,7 @@ import java.util.ArrayList;
* Expression.
*/
public class ExpressionChangePopUp extends DIbuggerPopUp {
private static final long serialVersionUID = -536310025600680559L;
private static String DELETE = "L\u00f6schen";
private static String ADJUST_SCOPEASSIGNMENT = "Bereichsbindung anpassen";
......@@ -31,9 +32,9 @@ public class ExpressionChangePopUp extends DIbuggerPopUp {
private JComboBox<String> optionChooser;
private JButton okButton;
private JScrollPane scrollPane;
private int row;
private JTable table;
private ExpressionPanel panel;
// private int row;
// private JTable table;
// private ExpressionPanel panel;
private String type = "";
private int expressionId;
private ArrayList<ScopeTuple> scopes = new ArrayList<>();
......@@ -64,10 +65,10 @@ public class ExpressionChangePopUp extends DIbuggerPopUp {
// init:
this.mainInterface = mainInterface;
setLanguage();
this.row = row;
// this.row = row;
this.expressionId = expressionId;
this.panel = panel;
this.table = table;
// this.panel = panel;
// this.table = table;
this.setSize(400, 400);
this.setResizable(false);
......@@ -186,6 +187,10 @@ public class ExpressionChangePopUp extends DIbuggerPopUp {
}
private class ProgramScopeChooser extends JPanel {
/**
*
*/
private static final long serialVersionUID = 5285187627472557802L;
JTextField begin;
JTextField end;
FlowLayout layout;
......
......@@ -12,6 +12,7 @@ import java.util.ArrayList;
* StepSize, variable input, Watch expression or conditional breakpoint.
*/
public class VariableSuggestionPopUp extends DIbuggerPopUp {
private static final long serialVersionUID = 6528738012375592708L;
private static String FROM = "von";
private static String TO = "bis";
......@@ -74,7 +75,7 @@ public class VariableSuggestionPopUp extends DIbuggerPopUp {
intervallEndField.setPreferredSize(new Dimension(100, 30));
JLabel intervallLabel = new JLabel();
JLabel typeLabel = new JLabel();
JComboBox typeChooser = new JComboBox<>();
JComboBox<String> typeChooser = new JComboBox<>();
JButton okButton = new JButton();
JLabel suggestionLabel = new JLabel();
suggestedLabel = new JTextField();
......@@ -92,7 +93,7 @@ public class VariableSuggestionPopUp extends DIbuggerPopUp {
typeLabel.setText(TYPE + ":");
typeChooser.setModel(
new DefaultComboBoxModel<>(new String[] { "int", "char", "long", "float", "double", "boolean" }));
new DefaultComboBoxModel<String>(new String[] { "int", "char", "long", "float", "double", "boolean" }));
okButton.setText("Ok");
......@@ -165,7 +166,7 @@ public class VariableSuggestionPopUp extends DIbuggerPopUp {
// TODO: evtl. keine Programme auswählen und keinen Vorschlag anzeigen
JLabel programLabel = new JLabel();
JLabel headerLabel = new JLabel();
JComboBox programChooser = new JComboBox<>();
JComboBox<String> programChooser = new JComboBox<>();
JLabel stepSizeSuggestionLabel = new JLabel();
JLabel suggestedLabel = new JLabel();
JButton okButton = new JButton();
......@@ -176,11 +177,11 @@ public class VariableSuggestionPopUp extends DIbuggerPopUp {
headerLabel.setText(STEPSIZE + " " + SUGGESTION);
ArrayList programs = mainInterface.getProgramIds();
ArrayList<String> programs = mainInterface.getProgramIds();
String[] programsAsArray = new String[programs.size()];
programs.toArray(programsAsArray);
programChooser.setModel(new DefaultComboBoxModel<>(programsAsArray));
programChooser.setModel(new DefaultComboBoxModel<String>(programsAsArray));
stepSizeSuggestionLabel.setText(STEPSIZE + " " + SUGGESTION);
......
......@@ -9,7 +9,6 @@ import dibugger.debuglogic.debugger.DebugControl;
import dibugger.debuglogic.debugger.DebugLogicFacade;
import dibugger.debuglogic.debugger.ProgramInput;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
import dibugger.debuglogic.exceptions.IdentifierNotFoundException;
import static org.junit.Assert.*;
......
......@@ -27,7 +27,6 @@ import dibugger.debuglogic.interpreter.IfElseCommand;
import dibugger.debuglogic.interpreter.ReturnCommand;
import dibugger.debuglogic.interpreter.RoutineCall;
import dibugger.debuglogic.interpreter.RoutineCommand;
import dibugger.debuglogic.interpreter.TermGenerationVisitor;
import dibugger.debuglogic.interpreter.WhileCommand;
......
package test.debuglogic.interpreter;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
......
package test.debuglogic.interpreter;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
......@@ -12,7 +10,6 @@ import org.junit.Test;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
import dibugger.debuglogic.exceptions.SyntaxException;
import dibugger.debuglogic.interpreter.GenerationController;
import dibugger.debuglogic.interpreter.Trace;
import dibugger.debuglogic.interpreter.TraceState;
public class GenerationControllerTest {
......@@ -25,7 +22,7 @@ public class GenerationControllerTest {
GenerationController gc = new GenerationController(10000, 10000);
ListIterator<TraceState> iterator = gc.generateTrace(code, input, "A");
while (iterator.hasNext()) {
TraceState state = iterator.next();
// TraceState state = iterator.next();
/*
* System.out.println("linenumber: "+ state.getLineNumber());
* System.out.println("existing variables: "+
......@@ -45,7 +42,7 @@ public class GenerationControllerTest {
GenerationController gc = new GenerationController(10000, 10000);
ListIterator<TraceState> iterator = gc.generateTrace(code, input, "A");
while (iterator.hasNext()) {
TraceState state = iterator.next();
// TraceState state = iterator.next();
/*
* System.out.println("linenumber: "+ state.getLineNumber());
* System.out.println("existing variables: "+
......@@ -67,7 +64,7 @@ public class GenerationControllerTest {
GenerationController gc = new GenerationController(10000, 10000);
ListIterator<TraceState> iterator = gc.generateTrace(code, input, "A");
while (iterator.hasNext()) {
TraceState state = iterator.next();
// TraceState state = iterator.next();
/*
* System.out.println("linenumber: "+ state.getLineNumber());
* System.out.println("existing variables: "+
......@@ -88,7 +85,7 @@ public class GenerationControllerTest {
GenerationController gc = new GenerationController(10000, 10000);
ListIterator<TraceState> iterator = gc.generateTrace(code, input, "A");
while (iterator.hasNext()) {
TraceState state = iterator.next();
// TraceState state = iterator.next();
/*
* System.out.println("linenumber: "+ state.getLineNumber());
* System.out.println("existing variables: "+
......@@ -110,7 +107,7 @@ public class GenerationControllerTest {
GenerationController gc = new GenerationController(10000, 10000);
ListIterator<TraceState> iterator = gc.generateTrace(code, input, "A");
while (iterator.hasNext()) {
TraceState state = iterator.next();
// TraceState state = iterator.next();
/*
* System.out.println("linenumber: "+ state.getLineNumber());
* System.out.println("existing variables: "+
......@@ -157,7 +154,8 @@ public class GenerationControllerTest {
List<String> input = new ArrayList<String>();
input.add(" k = 5 ");
GenerationController gc = new GenerationController(10000, 10000);
ListIterator<TraceState> iterator = gc.generateTrace(code, input, "A");
// ListIterator<TraceState> iterator =
gc.generateTrace(code, input, "A");
assert (gc.getReturnValue().toString().equals("120"));
}
......@@ -211,7 +209,8 @@ public class GenerationControllerTest {
input.add("");
GenerationController gc = new GenerationController(10000, 10000);
ListIterator<TraceState> iterator = gc.generateTrace(code, input, "A");
// ListIterator<TraceState> iterator =
gc.generateTrace(code, input, "A");
}
}
package test.debuglogic.interpreter;
import static org.junit.Assert.*;
import org.junit.Test;
import dibugger.debuglogic.interpreter.ScopeTuple;
......
package test.debuglogic.interpreter;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
......
package test.debuglogic.interpreter;
import static org.junit.Assert.*;
import org.junit.Test;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
......
......@@ -14,18 +14,12 @@ import dibugger.debuglogic.antlrparser.WlangLexer;
import dibugger.debuglogic.antlrparser.WlangParser;
import dibugger.debuglogic.interpreter.AdditionTerm;
import dibugger.debuglogic.interpreter.AndCondition;
import dibugger.debuglogic.interpreter.Assignment;
import dibugger.debuglogic.interpreter.BinaryArithmeticTerm;
import dibugger.debuglogic.interpreter.BinaryCondition;
import dibugger.debuglogic.interpreter.Command;
import dibugger.debuglogic.interpreter.CommandGenerationVisitor;
import dibugger.debuglogic.interpreter.Comparison;
import dibugger.debuglogic.interpreter.ConstantTerm;
import dibugger.debuglogic.interpreter.Declaration;
import dibugger.debuglogic.interpreter.DeclarationAssignment;
import dibugger.debuglogic.interpreter.DivisionTerm;
import dibugger.debuglogic.interpreter.EqualComparison;
import dibugger.debuglogic.interpreter.IfCommand;
import dibugger.debuglogic.interpreter.LessComparison;
import dibugger.debuglogic.interpreter.LessEqualComparison;
import dibugger.debuglogic.interpreter.ModuloTerm;
......@@ -35,13 +29,10 @@ import dibugger.debuglogic.interpreter.MultiplicationTerm;
import dibugger.debuglogic.interpreter.NotCondition;
import dibugger.debuglogic.interpreter.NotEqualComparison;
import dibugger.debuglogic.interpreter.OrCondition;
import dibugger.debuglogic.interpreter.ReturnCommand;
import dibugger.debuglogic.interpreter.RoutineCommand;
import dibugger.debuglogic.interpreter.SubtractionTerm;
import dibugger.debuglogic.interpreter.Term;
import dibugger.debuglogic.interpreter.TermGenerationVisitor;
import dibugger.debuglogic.interpreter.VariableTerm;
import dibugger.debuglogic.interpreter.WhileCommand;
public class TermGenerationVisitorTest {
......
......@@ -6,7 +6,6 @@ import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
......
......@@ -5,22 +5,12 @@ import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import dibugger.debuglogic.antlrparser.WlangLexer;
import dibugger.debuglogic.antlrparser.WlangParser;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
import dibugger.debuglogic.interpreter.DoubleValue;
import dibugger.debuglogic.interpreter.Scope;
import dibugger.debuglogic.interpreter.ScopeTuple;
import dibugger.debuglogic.interpreter.Term;
import dibugger.debuglogic.interpreter.TermGenerationVisitor;
import dibugger.debuglogic.interpreter.TraceState;
import dibugger.debuglogic.interpreter.TraceStatePosition;
import dibugger.debuglogic.interpreter.Type;
......
......@@ -13,7 +13,6 @@ import dibugger.debuglogic.interpreter.ArrayElementAssignment;
import dibugger.debuglogic.interpreter.ArrayValue;
import dibugger.debuglogic.interpreter.Command;
import dibugger.debuglogic.interpreter.ConstantTerm;
import dibugger.debuglogic.interpreter.Declaration;
import dibugger.debuglogic.interpreter.GenerationController;
import dibugger.debuglogic.interpreter.IntValue;
import dibugger.debuglogic.interpreter.Scope;
......
......@@ -39,9 +39,9 @@ public class AssignmentTest {
Term t = new AdditionTerm(new VariableTerm("x"), new ConstantTerm(new IntValue(k))); // x+k
Command assign = new Assignment(gc, 4, "x", t);
List<TraceState> result = assign.run(); // run it
assertEquals(s.getValueOf("x").toString(),(new Integer(3 + k).toString()));
assertEquals(s.getValueOf("x").toString(),(Integer.valueOf(3 + k).toString()));
assertEquals(result.size(),1);
assertEquals(result.get(0).getValueOf("x").toString(),(new Integer(3 + k).toString()));
assertEquals(result.get(0).getValueOf("x").toString(),(Integer.valueOf(3 + k).toString()));
}
for (int k = 0; k < 1000; k++) {
......@@ -55,9 +55,9 @@ public class AssignmentTest {
Term t = new MultiplicationTerm(new VariableTerm("y"), new ConstantTerm(new IntValue(k))); // y*k
Command assign = new Assignment(gc, 4, "y", t);
List<TraceState> result = assign.run(); // run it
assertEquals (s.getValueOf("y").toString(), (new Integer(3 * k).toString()));
assertEquals (s.getValueOf("y").toString(), (Integer.valueOf(3 * k).toString()));
assertEquals(result.size(), 1);
assertEquals(result.get(0).getValueOf("y").toString(), (new Integer(3 * k).toString()));
assertEquals(result.get(0).getValueOf("y").toString(), (Integer.valueOf(3 * k).toString()));
}
}
......@@ -69,7 +69,8 @@ public class AssignmentTest {
gc.pushScope(s);
// create Command
Command assign = new Assignment(gc, 1, "y", new ConstantTerm(new IntValue(3)));
List<TraceState> result = assign.run(); // run it
// List<TraceState> result =
assign.run(); // run it
}
@Test(expected=WrongTypeAssignmentException.class)
......@@ -81,6 +82,7 @@ public class AssignmentTest {
gc.pushScope(s);
// create Command
Command assign = new Assignment(gc, 1, "x", new ConstantTerm(new IntValue(3)));
List<TraceState> result = assign.run(); // run it
// List<TraceState> result =
assign.run(); // run it
}
}
......@@ -41,9 +41,11 @@ public class DeclarationAssignmentTest {
// create Command
Command decAssign = new DeclarationAssignment(gc, 0, "var", Type.DOUBLE,
new ConstantTerm(new DoubleValue(2.0)));
List<TraceState> result = decAssign.run(); // run it
// List<TraceState> result =
decAssign.run(); // run it
// run Command a second time
List<TraceState> result2 = decAssign.run(); // run it
// List<TraceState> result2 =
decAssign.run(); // run it
}
@Test(expected = WrongTypeAssignmentException.class)
......@@ -54,7 +56,8 @@ public class DeclarationAssignmentTest {
// create Command
Command decAssign = new DeclarationAssignment(gc, 0, "var", Type.BOOLEAN,
new ConstantTerm(new DoubleValue(2.0)));
List<TraceState> result = decAssign.run(); // run it
// List<TraceState> result =
decAssign.run(); // run it
}
}
......@@ -36,9 +36,11 @@ public class DeclarationTest {
gc.pushScope(s);
// create Command
Command declare = new Declaration(gc, 0, "var", Type.DOUBLE);
List<TraceState> result = declare.run(); // run it
// List<TraceState> result =
declare.run(); // run it
// run Command a second time
List<TraceState> result2 = declare.run();
// List<TraceState> result2 =
declare.run();
}
}
\ No newline at end of file
......@@ -8,7 +8,6 @@ import org.junit.Test;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
import dibugger.debuglogic.exceptions.WrongTypeArgumentException;
import dibugger.debuglogic.exceptions.WrongTypeAssignmentException;
import dibugger.debuglogic.interpreter.Assignment;
import dibugger.debuglogic.interpreter.BooleanValue;
import dibugger.debuglogic.interpreter.ConstantTerm;
......
......@@ -53,7 +53,8 @@ public class IfElseCommandTest {
s.setValueOf("result", new IntValue(0));
gc.pushScope(s);
//if(val) {result=1} else {result=2}
IfCommand ifcmd = new IfCommand(gc, 1, new VariableTerm("val"));
// IfCommand ifcmd =
new IfCommand(gc, 1, new VariableTerm("val"));
IfElseCommand cmd = new IfElseCommand(gc, 1, new VariableTerm("val"));
Assignment assignIfChild = new Assignment(gc, 0, "result", new ConstantTerm(new IntValue(1)));
Assignment assignElseChild = new Assignment(gc, 0, "result", new ConstantTerm(new IntValue(2)));
......
......@@ -2,8 +2,6 @@ package test.debuglogic.interpreter.commands;
import static org.junit.Assert.assertEquals;
import java.util.List;
import org.junit.Test;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
......@@ -12,8 +10,6 @@ import dibugger.debuglogic.interpreter.GenerationController;
import dibugger.debuglogic.interpreter.IntValue;
import dibugger.debuglogic.interpreter.ReturnCommand;
import dibugger.debuglogic.interpreter.Scope;
import dibugger.debuglogic.interpreter.TraceState;
import dibugger.debuglogic.interpreter.TraceStatePosition;
public class ReturnCommandTest {
......@@ -23,7 +19,8 @@ public class ReturnCommandTest {
Scope s = new Scope();
ReturnCommand returnCommand = new ReturnCommand(gc, 5, new ConstantTerm(new IntValue(5)));
gc.pushScope(s);
List<TraceState> traceStateList = returnCommand.run();
// List<TraceState> traceStateList =
returnCommand.run();
// assertEquals(gc.getReturnValue(), new IntValue(5).getValue());
assertEquals(gc.getCurrentScope().isRoutineFinished(), true);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment