use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class LessThanEqualToEvaluatorTest method lteDifferentTypes1.
@Test(expected = IOException.class)
public void lteDifferentTypes1() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("lte(a,b)");
values.clear();
values.put("a", true);
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 LessThanEqualToEvaluatorTest method lteTwoStrings.
@Test
public void lteTwoStrings() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("lte(a,b)");
Object result;
String foo = "foo";
String bar = "bar";
values.clear();
values.put("a", "foo");
values.put("b", "foo");
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", "foo");
values.put("b", "bar");
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", "foo bar baz");
values.put("b", "foo bar baz");
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", "foo bar baz");
values.put("b", "foo bar jaz");
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", foo);
values.put("b", foo);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", foo);
values.put("b", bar);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class LessThanEvaluatorTest method ltTwoBooleans.
@Test(expected = IOException.class)
public void ltTwoBooleans() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("lt(a,b)");
values.clear();
values.put("a", true);
values.put("b", true);
evaluator.evaluate(new Tuple(values));
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class LessThanEvaluatorTest method ltDifferentTypes4.
@Test(expected = IOException.class)
public void ltDifferentTypes4() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("lt(a,b)");
values.clear();
values.put("a", "true");
values.put("b", true);
evaluator.evaluate(new Tuple(values));
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class LessThanEvaluatorTest method ltTwoIntegers.
@Test
public void ltTwoIntegers() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("lt(a,b)");
Object result;
values.clear();
values.put("a", 1);
values.put("b", 1);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", 1);
values.put("b", 1.0);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", 1.0);
values.put("b", 1);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", 1);
values.put("b", 2);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", -1);
values.put("b", -1);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", 1);
values.put("b", 2.0);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", 1.0);
values.put("b", 2);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", 2);
values.put("b", 1);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", 2);
values.put("b", 1.0);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", 2.0);
values.put("b", 1);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", 3);
values.put("b", 2);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", -1);
values.put("b", -2);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", 3);
values.put("b", 2.0);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", 3.0);
values.put("b", 2);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
}
Aggregations