degree support
This commit is contained in:
parent
18e9fc3803
commit
951e030e08
@ -9,6 +9,7 @@
|
|||||||
xmlns:calc="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
|
xmlns:calc="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
|
||||||
a:id="@+id/plusButton"
|
a:id="@+id/plusButton"
|
||||||
calc:directionTextScale="0.5"
|
calc:directionTextScale="0.5"
|
||||||
|
calc:textUp="°"
|
||||||
a:text="+"
|
a:text="+"
|
||||||
style="?digitButtonStyle"
|
style="?digitButtonStyle"
|
||||||
a:onClick="digitButtonClickHandler"/>
|
a:onClick="digitButtonClickHandler"/>
|
@ -252,16 +252,21 @@ public class CalculatorEngineTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Test
|
@Test
|
||||||
public void testDegrees() throws Exception {
|
public void testDegrees() throws Exception {
|
||||||
final CalculatorEngine cm = CalculatorEngine.instance;
|
final CalculatorEngine cm = CalculatorEngine.instance;
|
||||||
|
|
||||||
cm.setPrecision(3);
|
cm.setPrecision(3);
|
||||||
|
try {
|
||||||
Assert.assertEquals("0.017", cm.evaluate(JsclOperation.numeric, "°"));
|
Assert.assertEquals("0.017", cm.evaluate(JsclOperation.numeric, "°"));
|
||||||
Assert.assertEquals("0.017", cm.evaluate(JsclOperation.numeric, "1°"));
|
fail();
|
||||||
Assert.assertEquals("0.349", cm.evaluate(JsclOperation.numeric, "20.0°"));
|
} catch (ParseException e) {
|
||||||
Assert.assertEquals("0.5", cm.evaluate(JsclOperation.numeric, "sin(30°)"));
|
|
||||||
Assert.assertEquals("0.524", cm.evaluate(JsclOperation.numeric, "asin(sin(30°))"));
|
|
||||||
|
|
||||||
}*/
|
}
|
||||||
|
Assert.assertEquals("0.017", cm.evaluate(JsclOperation.numeric, "1°").getResult());
|
||||||
|
Assert.assertEquals("0.349", cm.evaluate(JsclOperation.numeric, "20.0°").getResult());
|
||||||
|
Assert.assertEquals("0.5", cm.evaluate(JsclOperation.numeric, "sin(30°)").getResult());
|
||||||
|
Assert.assertEquals("0.524", cm.evaluate(JsclOperation.numeric, "asin(sin(30°))").getResult());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user