degree support
This commit is contained in:
parent
457cb4db0c
commit
4312f7c475
@ -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);
|
||||||
Assert.assertEquals("0.017", cm.evaluate(JsclOperation.numeric, "°"));
|
try {
|
||||||
Assert.assertEquals("0.017", cm.evaluate(JsclOperation.numeric, "1°"));
|
Assert.assertEquals("0.017", cm.evaluate(JsclOperation.numeric, "°"));
|
||||||
Assert.assertEquals("0.349", cm.evaluate(JsclOperation.numeric, "20.0°"));
|
fail();
|
||||||
Assert.assertEquals("0.5", cm.evaluate(JsclOperation.numeric, "sin(30°)"));
|
} catch (ParseException e) {
|
||||||
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