use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class ModuloEvaluatorTest method modTwoFieldsWithNullDenominator.
@Test(expected = IOException.class)
public void modTwoFieldsWithNullDenominator() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
values.clear();
values.put("a", 1);
evaluator.evaluate(new Tuple(values));
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class ModuloEvaluatorTest method modTwoFieldsWithNullNumerator.
@Test(expected = IOException.class)
public void modTwoFieldsWithNullNumerator() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("mod(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 MultiplyEvaluatorTest method multTwoFieldsWithValues.
@Test
public void multTwoFieldsWithValues() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
Object result;
values.clear();
values.put("a", 1);
values.put("b", 2);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Long);
Assert.assertEquals(2L, 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(2.2D, 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(2.31D, result);
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class HyperbolicSineEvaluatorTest method noValue.
@Test
public void noValue() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("sinh(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 HyperbolicTangentEvaluatorTest method test.
private void test(Double value) throws IOException {
StreamEvaluator evaluator = factory.constructEvaluator("tanh(a)");
values.clear();
values.put("a", value);
Object result = evaluator.evaluate(new Tuple(values));
if (null == value) {
Assert.assertNull(result);
} else {
Assert.assertTrue(result instanceof Double);
Assert.assertEquals(Math.tanh(value), result);
}
}
Aggregations