public void testBuiltin() throws EvaluationException { ITerm daytimeduration1 = Factory.CONCRETE.createDayTimeDuration(true, 15, 23, 19, 12.0); ITerm daytimeduration2 = Factory.CONCRETE.createDayTimeDuration(true, 14, 22, 18, 11.0); ITerm result = Factory.CONCRETE.createDayTimeDuration(true, 1, 1, 1, 1.0); DayTimeDurationSubtractBuiltin builtin = new DayTimeDurationSubtractBuiltin(X, Y, Z); args = Factory.BASIC.createTuple(daytimeduration1, daytimeduration2, result); actual = builtin.evaluate(args); assertEquals(EMPTY_TUPLE, actual); }
public void testBuiltin() throws EvaluationException { ITerm date1 = Factory.CONCRETE.createYearMonthDuration(true, 2, 4); ITerm date2 = Factory.CONCRETE.createDouble(2.0); ITerm result = Factory.CONCRETE.createYearMonthDuration(true, 4, 8); YearMonthDurationMultiplyBuiltin builtin = new YearMonthDurationMultiplyBuiltin(date1, date2, result); args = Factory.BASIC.createTuple(X, Y, Z); actual = builtin.evaluate(args); assertEquals(EMPTY_TUPLE, actual); }
public void testBuiltin() throws EvaluationException { ITerm daytimeduration = Factory.CONCRETE.createDayTimeDuration(true, 0, 2, 0, 0, 0); ITerm time1 = Factory.CONCRETE.createTime(10, 4, 26.3, 0, 0); ITerm result = Factory.CONCRETE.createTime(12, 4, 26.3, 0, 0); AddBuiltin builtin = new AddDayTimeDurationToTimeBuiltin(X, Y, Z); args = Factory.BASIC.createTuple(time1, daytimeduration, result); actual = builtin.evaluate(args); assertEquals(EMPTY_TUPLE, actual); }
protected ITerm computeResult(ITerm[] terms) throws EvaluationException { if (terms[0] instanceof IStringTerm && terms[1] instanceof IStringTerm) { int result = BuiltinHelper.compare(terms[0], terms[1]); return Factory.CONCRETE.createInteger(result); } return null; }
public void testBuiltin() throws EvaluationException { ITerm date1 = Factory.CONCRETE.createDate(2010, 4, 26); ITerm date2 = Factory.CONCRETE.createDate(2010, 4, 26); ITerm date3 = Factory.CONCRETE.createDate(1997, 3, 12); DateNotEqualBuiltin builtin = new DateNotEqualBuiltin(X, Y); args = Factory.BASIC.createTuple(date1, date1); actual = builtin.evaluate(args); assertEquals(null, actual); builtin = new DateNotEqualBuiltin(X, Y); args = Factory.BASIC.createTuple(date1, date2); actual = builtin.evaluate(args); assertEquals(null, actual); builtin = new DateNotEqualBuiltin(X, Y); args = Factory.BASIC.createTuple(date1, date3); actual = builtin.evaluate(args); assertEquals(EMPTY_TUPLE, actual); }