use of org.eclipse.core.internal.expressions.CountExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testCountExpressionNoneWithAdapterManager.
public void testCountExpressionNoneWithAdapterManager() throws Exception {
// $NON-NLS-1$
CountExpression exp = new CountExpression("!");
List<String> list = new ArrayList<>();
CollectionWrapper wrapper = new CollectionWrapper();
wrapper.collection = list;
EvaluationContext context = new EvaluationContext(null, wrapper);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
list.clear();
// $NON-NLS-1$
list.add("one");
context = new EvaluationContext(null, wrapper);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
list.clear();
// $NON-NLS-1$
list.add("one");
// $NON-NLS-1$
list.add("two");
context = new EvaluationContext(null, wrapper);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
use of org.eclipse.core.internal.expressions.CountExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testCountExpressionAnyNumber.
public void testCountExpressionAnyNumber() throws Exception {
// $NON-NLS-1$
CountExpression exp = new CountExpression("*");
List<String> list = new ArrayList<>();
EvaluationContext context = new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
list.clear();
// $NON-NLS-1$
list.add("one");
context = new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
list.clear();
// $NON-NLS-1$
list.add("one");
// $NON-NLS-1$
list.add("two");
// $NON-NLS-1$
list.add("three");
context = new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
use of org.eclipse.core.internal.expressions.CountExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testCountExpressionExact.
public void testCountExpressionExact() throws Exception {
// $NON-NLS-1$
CountExpression exp = new CountExpression("2");
List<String> list = new ArrayList<>();
// $NON-NLS-1$
list.add("one");
EvaluationContext context = new EvaluationContext(null, list);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
list.clear();
// $NON-NLS-1$
list.add("one");
// $NON-NLS-1$
list.add("two");
context = new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
list.clear();
// $NON-NLS-1$
list.add("one");
// $NON-NLS-1$
list.add("two");
// $NON-NLS-1$
list.add("three");
context = new EvaluationContext(null, list);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
use of org.eclipse.core.internal.expressions.CountExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testCountExpressionNoneOrOne.
public void testCountExpressionNoneOrOne() throws Exception {
// $NON-NLS-1$
CountExpression exp = new CountExpression("?");
List<String> list = new ArrayList<>();
EvaluationContext context = new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
list.clear();
// $NON-NLS-1$
list.add("one");
context = new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
list.clear();
// $NON-NLS-1$
list.add("one");
// $NON-NLS-1$
list.add("two");
context = new EvaluationContext(null, list);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
use of org.eclipse.core.internal.expressions.CountExpression in project eclipse.platform.runtime by eclipse.
the class CountExpressionTest method testNoneExpression.
public void testNoneExpression() throws CoreException {
// $NON-NLS-1$
CountExpression e = new CountExpression("!");
Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(0)));
Assert.assertEquals(EvaluationResult.FALSE, e.evaluate(evaluationContext(1)));
}
Aggregations