Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ha1_pull_2Origin #109

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Current File",
"request": "launch",
"mainClass": "${file}"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.compile.nullAnalysis.mode": "automatic"
}
57 changes: 57 additions & 0 deletions app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,62 @@ void testMultipleDecimalDots() {


//TODO hier weitere Tests erstellen
@Test
@DisplayName("Should display result after subtracting two positive numbers")
void testSubtract(){
Calculator calc = new Calculator();

calc.pressDigitKey(3);
calc.pressBinaryOperationKey("-");
calc.pressDigitKey(2);
calc.pressEqualsKey();

String expected = "1";
String actual = calc.readScreen();

assertEquals(expected,actual);
}
//TODO hier rote tests erstellen
@Test
@DisplayName("Should respect punkt vor strich")
void shshshsh(){
Calculator calc = new Calculator();

calc.pressDigitKey(4);
calc.pressBinaryOperationKey("+");
calc.pressDigitKey(1);
calc.pressBinaryOperationKey("x");
calc.pressDigitKey(5);
calc.pressEqualsKey();

String expected = "9";
String actual = calc.readScreen();

assertEquals(expected,actual);

}
@Test
@DisplayName("komplexe berechnung")
void asasdasdasd(){
Calculator calc = new Calculator();

calc.pressDigitKey(1);
calc.pressDigitKey(0);
calc.pressBinaryOperationKey("+");
calc.pressDigitKey(2);
calc.pressBinaryOperationKey("x");
calc.pressDigitKey(6);
calc.pressBinaryOperationKey("/");
calc.pressDigitKey(3);
calc.pressBinaryOperationKey("-");
calc.pressDigitKey(5);
calc.pressEqualsKey();

String expected = "9";
String actual = calc.readScreen();

assertEquals(expected, actual);
}

}