use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestExprLib method testSafeEquality.
private static void testSafeEquality(String string, boolean b, boolean graphString, boolean graphNumber) {
Expr expr = ExprUtils.parse(string);
Assert.assertEquals(string, b, ExprLib.isAssignmentSafeEquality(expr, graphString, graphNumber));
}
use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestExpressions method testVar.
private static void testVar(String string, String rightVarName) {
Expr expr = parse(string);
assertTrue("Not a NodeVar: " + expr, expr.isVariable());
ExprVar v = (ExprVar) expr;
assertEquals("Different variable names", rightVarName, v.getVarName());
}
use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestExpressions2 method eval.
// It's easier to write tests that simply are expected to return true/false
/*package*/
static void eval(String string, boolean result) {
Expr expr = ExprUtils.parse(string);
NodeValue nv = expr.eval(null, FunctionEnvBase.createTest());
boolean b = XSDFuncOp.booleanEffectiveValue(nv);
assertEquals(string, result, b);
}
use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestSSE_Builder method testBuildExpr_01.
@Test
public void testBuildExpr_01() {
Expr e = SSE.parseExpr("(sameTerm (?x) (?y))");
assertTrue(e instanceof E_SameTerm);
}
use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestRegex method regexTest.
public void regexTest(String value, String pattern, String flags, boolean expected) {
Expr s = NodeValue.makeString(value);
E_Regex r = new E_Regex(s, pattern, flags);
NodeValue nv = r.eval(BindingFactory.binding(), null);
boolean b = nv.getBoolean();
if (b != expected)
fail(fmtTest(value, pattern, flags) + " ==> " + b + " expected " + expected);
}
Aggregations