Search in sources :

Example 1 with CountExpression

use of org.eclipse.core.internal.expressions.CountExpression in project eclipse.platform.runtime by eclipse.

the class CountExpressionTest method testNoneOrOneExpression.

public void testNoneOrOneExpression() throws CoreException {
    // $NON-NLS-1$
    CountExpression e = new CountExpression("?");
    Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(0)));
    Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(1)));
    Assert.assertEquals(EvaluationResult.FALSE, e.evaluate(evaluationContext(2)));
}
Also used : CountExpression(org.eclipse.core.internal.expressions.CountExpression)

Example 2 with CountExpression

use of org.eclipse.core.internal.expressions.CountExpression in project eclipse.platform.runtime by eclipse.

the class CountExpressionTest method testAnyNumberExpression.

public void testAnyNumberExpression() throws CoreException {
    // $NON-NLS-1$
    CountExpression e = new CountExpression("*");
    Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(5)));
}
Also used : CountExpression(org.eclipse.core.internal.expressions.CountExpression)

Example 3 with CountExpression

use of org.eclipse.core.internal.expressions.CountExpression in project eclipse.platform.runtime by eclipse.

the class CountExpressionTest method testGreaterThanExpression.

// @Test
// public void testGreaterThanOrEqualToExpression() throws CoreException {
// CountExpression e = new CountExpression("[3-"); //$NON-NLS-1$
// Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(5)));
// Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(3)));
// Assert.assertEquals(EvaluationResult.FALSE, e.evaluate(evaluationContext(2)));
// }
public void testGreaterThanExpression() throws CoreException {
    // $NON-NLS-1$
    CountExpression e = new CountExpression("(3-");
    Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(5)));
    Assert.assertEquals(EvaluationResult.FALSE, e.evaluate(evaluationContext(3)));
    Assert.assertEquals(EvaluationResult.FALSE, e.evaluate(evaluationContext(2)));
}
Also used : CountExpression(org.eclipse.core.internal.expressions.CountExpression)

Example 4 with CountExpression

use of org.eclipse.core.internal.expressions.CountExpression in project eclipse.platform.runtime by eclipse.

the class CountExpressionTest method testExactExpression.

public void testExactExpression() throws CoreException {
    // $NON-NLS-1$
    CountExpression e = new CountExpression("5");
    Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(5)));
    Assert.assertEquals(EvaluationResult.FALSE, e.evaluate(evaluationContext(7)));
}
Also used : CountExpression(org.eclipse.core.internal.expressions.CountExpression)

Example 5 with CountExpression

use of org.eclipse.core.internal.expressions.CountExpression in project eclipse.platform.runtime by eclipse.

the class CountExpressionTest method testLessThanExpression.

// @Test
// public void testLessThanOrEqualToExpression() throws CoreException {
// CountExpression e = new CountExpression("-3]"); //$NON-NLS-1$
// Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(1)));
// Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(3)));
// Assert.assertEquals(EvaluationResult.FALSE, e.evaluate(evaluationContext(4)));
// }
public void testLessThanExpression() throws CoreException {
    // $NON-NLS-1$
    CountExpression e = new CountExpression("-3)");
    Assert.assertEquals(EvaluationResult.TRUE, e.evaluate(evaluationContext(1)));
    Assert.assertEquals(EvaluationResult.FALSE, e.evaluate(evaluationContext(3)));
    Assert.assertEquals(EvaluationResult.FALSE, e.evaluate(evaluationContext(4)));
}
Also used : CountExpression(org.eclipse.core.internal.expressions.CountExpression)

Aggregations

CountExpression (org.eclipse.core.internal.expressions.CountExpression)18 EvaluationContext (org.eclipse.core.expressions.EvaluationContext)7 IEvaluationContext (org.eclipse.core.expressions.IEvaluationContext)7 ArrayList (java.util.ArrayList)6 EvaluationResult (org.eclipse.core.expressions.EvaluationResult)1 AndExpression (org.eclipse.core.internal.expressions.AndExpression)1 ResolveExpression (org.eclipse.core.internal.expressions.ResolveExpression)1 WithExpression (org.eclipse.core.internal.expressions.WithExpression)1 CoreException (org.eclipse.core.runtime.CoreException)1