Resolve the bug of C and add a test case

This commit is contained in:
WddVictor 2019-12-20 23:21:49 +08:00
parent 13ae2b25cf
commit e6762dcec1
2 changed files with 16 additions and 1 deletions

View File

@ -42,6 +42,22 @@ public class MainActivityTest {
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
public void additionTest() {
press(R.id.btn_minus);

View File

@ -161,7 +161,6 @@ class CalculatorImpl(calculator: Calculator, val context: Context) {
newValue = newValue.replace("\\.$".toRegex(), "")
newValue = formatString(newValue)
setValue(newValue)
mBaseValue = Formatter.stringToDouble(newValue)
}
}