private void check(ITerm listOne, ITerm expectedResult) throws EvaluationException {
    builtin = new DistinctValuesBuiltin(listOne);

    ITuple arguments = BASIC.createTuple(X, Y, Z);

    ITuple expectedTuple = BASIC.createTuple(expectedResult);

    ITuple actualTuple = builtin.evaluate(arguments);

    assertEquals(expectedTuple, actualTuple);
  }
  private ITuple compute(ITerm term) throws EvaluationException {
    ToDayTimeDurationBuiltin builtin = new ToDayTimeDurationBuiltin(term, Y);

    ITuple arguments = BASIC.createTuple(X, Y);
    ITuple actualTuple = builtin.evaluate(arguments);

    return actualTuple;
  }
Пример #3
0
  ILiteral createLiteral(boolean positive, String predicateName, Object... termObjects) {
    List<ITerm> terms = new ArrayList<ITerm>();

    for (Object o : termObjects) {
      if (o instanceof Integer) terms.add(CONCRETE.createInteger((Integer) o));
      else if (o instanceof String) terms.add(TERM.createVariable((String) o));
    }

    if (predicateName.equals("="))
      return BASIC.createLiteral(positive, new EqualBuiltin(terms.toArray(new ITerm[2])));

    return BASIC.createLiteral(
        positive,
        BASIC.createAtom(
            BASIC.createPredicate(predicateName, terms.size()), BASIC.createTuple(terms)));
  }
  private void equals(IDayTimeDuration expected, ITerm term) throws EvaluationException {
    ITuple expectedTuple = BASIC.createTuple(expected);
    ITuple actualTuple = compute(term);

    assertEquals(expectedTuple, actualTuple);
  }