BinaryPredicateOperator { private static FunctionResolver or() { return FunctionDSL.define(BuiltinFunctionName.OR.getName(), FunctionDSL .impl((v1, v2) -> lookupTableFunction(v1, v2, orTable), BOOLEAN, BOOLEAN, BOOLEAN)); }  static void register(BuiltinFunctionRepository repository);  }
@Test public void test_boolean_or_null() { FunctionExpression or = dsl.or(DSL.literal(LITERAL_TRUE), DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_TRUE, or.valueOf(valueEnv())); or = dsl.or(DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN), DSL.literal(LITERAL_TRUE)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_TRUE, or.valueOf(valueEnv())); or = dsl.or(DSL.literal(LITERAL_FALSE), DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_NULL, or.valueOf(valueEnv())); or = dsl.or(DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN), DSL.literal(LITERAL_FALSE)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_NULL, or.valueOf(valueEnv())); }
@Test public void test_boolean_or_missing() { FunctionExpression or = dsl.or(DSL.literal(LITERAL_TRUE), DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_TRUE, or.valueOf(valueEnv())); or = dsl.or(DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN), DSL.literal(LITERAL_TRUE)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_TRUE, or.valueOf(valueEnv())); or = dsl.or(DSL.literal(LITERAL_FALSE), DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_MISSING, or.valueOf(valueEnv())); or = dsl.or(DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN), DSL.literal(LITERAL_FALSE)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_MISSING, or.valueOf(valueEnv())); }
@Test public void test_null_or_missing() { FunctionExpression or = dsl.or(DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN), DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_MISSING, or.valueOf(valueEnv())); or = dsl.or(DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN), DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_NULL, or.valueOf(valueEnv())); or = dsl.or(DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN), DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_NULL, or.valueOf(valueEnv())); or = dsl.or(DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN), DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, or.type()); assertEquals(LITERAL_NULL, or.valueOf(valueEnv())); }