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