use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class HyperbolicTangentEvaluatorTest method noValue.
@Test
public void noValue() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("tanh(a)");
values.clear();
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class CubedRootEvaluatorTest method noValue.
@Test
public void noValue() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("cbrt(a)");
values.clear();
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class DivideEvaluatorTest method divTwoFieldsWithValues.
@Test
public void divTwoFieldsWithValues() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
Object result;
values.clear();
values.put("a", 1);
values.put("b", 2);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Double);
Assert.assertEquals(1.0 / 2, result);
values.clear();
values.put("a", 1.1);
values.put("b", 2);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Double);
Assert.assertEquals(1.1 / 2, result);
values.clear();
values.put("a", 1.1);
values.put("b", 2.1);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Double);
Assert.assertEquals(1.1 / 2.1, result);
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class DivideEvaluatorTest method divTwoFieldsWithMissingNumerator.
@Test(expected = IOException.class)
public void divTwoFieldsWithMissingNumerator() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
values.clear();
values.put("b", 1);
evaluator.evaluate(new Tuple(values));
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class DivideEvaluatorTest method divManyFieldsWithSubdivs.
@Test
public void divManyFieldsWithSubdivs() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("div(a,div(b,c))");
Object result;
values.clear();
values.put("a", 1);
values.put("b", 2);
values.put("c", 3);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Double);
Assert.assertEquals((1.0 / (2.0 / 3)), result);
}
Aggregations