mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-06-05 21:49:13 +02:00
Resolve the bug of C and add a test case
This commit is contained in:
@@ -42,6 +42,22 @@ public class MainActivityTest {
|
|||||||
checkResult("5");
|
checkResult("5");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void clearComplexTest(){
|
||||||
|
press(R.id.btn_1);
|
||||||
|
press(R.id.btn_plus);
|
||||||
|
press(R.id.btn_1);
|
||||||
|
press(R.id.btn_decimal);
|
||||||
|
press(R.id.btn_5);
|
||||||
|
press(R.id.btn_5);
|
||||||
|
press(R.id.btn_clear);
|
||||||
|
press(R.id.btn_1);
|
||||||
|
press(R.id.btn_equals);
|
||||||
|
checkResult("2.51");
|
||||||
|
checkFormula("1+1.51");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void additionTest() {
|
public void additionTest() {
|
||||||
press(R.id.btn_minus);
|
press(R.id.btn_minus);
|
||||||
|
@@ -161,7 +161,6 @@ class CalculatorImpl(calculator: Calculator, val context: Context) {
|
|||||||
newValue = newValue.replace("\\.$".toRegex(), "")
|
newValue = newValue.replace("\\.$".toRegex(), "")
|
||||||
newValue = formatString(newValue)
|
newValue = formatString(newValue)
|
||||||
setValue(newValue)
|
setValue(newValue)
|
||||||
mBaseValue = Formatter.stringToDouble(newValue)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user