Exemplo n.º 1
0
  public void test_IntegerLiteralExp_checkIntegerType() {
    IntegerLiteralExp il = factory.createIntegerLiteralExp();
    il.setLongSymbol(42L);
    il.setType(apple);

    assertProblem(il, ExpressionsValidator.INTEGER_LITERAL_EXP__INTEGER_TYPE);

    il.setType(getOCLStandardLibrary().getBoolean());

    assertProblem(il, ExpressionsValidator.INTEGER_LITERAL_EXP__INTEGER_TYPE);

    il.setType(getOCLStandardLibrary().getInteger());

    assertOK(il, ExpressionsValidator.INTEGER_LITERAL_EXP__INTEGER_TYPE);
  }
Exemplo n.º 2
0
  public void test_CollectionRange_checkRangeType() {
    CollectionRange r = factory.createCollectionRange();
    r.setType(fruit);

    IntegerLiteralExp first = factory.createIntegerLiteralExp();
    first.setType(apple);
    TupleLiteralExp last = factory.createTupleLiteralExp();
    last.setType(color);

    r.setFirst(first);
    r.setLast(last);

    assertProblem(r, ExpressionsValidator.COLLECTION_RANGE__RANGE_TYPE);

    last.setType(fruit);

    assertOK(r, ExpressionsValidator.COLLECTION_RANGE__RANGE_TYPE);
  }