private Map<String, Double> extractValues( Map<SymbolicReal, Object> vars) { Map<String, Double> vals = new HashMap<String,Double>(); for(SymbolicReal entry : vars.keySet()) { String name = entry.getName(); Double val = entry.solution; vals.put(name,val); } return vals; }
@Test public void divideReals() { Number actual = evaluate(x._div(y), realPoint(4.2, 0.7)); assertThat(actual.doubleValue(), equalTo(6.000000000000001)); }
@Test public void multiplyReals() { Number actual = evaluate(x._mul(y), realPoint(4.2, 0.1)); assertThat(actual.doubleValue(), equalTo(0.42000000000000004)); }
@Test public void negReals() { Number actual = evaluate(x._neg(), realPoint(3.14, 0)); assertThat(actual.doubleValue(), equalTo(-3.14)); }
@Test public void subtractReals() { Number actual = evaluate(x._minus(y), realPoint(2.89, 3.14)); assertThat(actual.doubleValue(), equalTo(-0.25)); }
@Test public void addReals() { Number actual = evaluate(x._plus(y), realPoint(3.0, 0.14)); assertThat(actual.doubleValue(), equalTo(3.14)); }