blob: cdfe7f1568f3abb04fdf8c53b98dcaf34c645baf [file] [log] [blame]
transformation bug428316();
modeltype qvto "strict" uses qvtoperational('http://www.eclipse.org/QVT/1.0.0/Operational');
intermediate property qvto::expressions::ImperativeOperation::ctx : qvto::expressions::VarParameter;
intermediate property qvto::expressions::ImperativeOperation::ctxSequence : Sequence(qvto::expressions::VarParameter);
intermediate property qvto::expressions::ImperativeOperation::ctxMap : Dict(String, qvto::expressions::VarParameter);
intermediate property qvto::expressions::ImperativeOperation::ctxMap2 : Dict(List(qvto::expressions::VarParameter), qvto::expressions::VarParameter);
intermediate property qvto::expressions::ImperativeOperation::ctxTuple : Tuple(obj : qvto::expressions::VarParameter, val : List(qvto::expressions::VarParameter));
main()
{
var operation := object qvto::expressions::ImperativeOperation { name:= 'testOperation' };
operation.context := object qvto::expressions::VarParameter { name := 'testContext'; ctxOwner := operation };
operation.ctx := operation.context;
operation.ctxSequence += operation.context;
operation.ctxMap->put(operation.context.name, operation.context);
var l := List{operation.context};
operation.ctxMap2->put(l, operation.context);
operation.ctxTuple := Tuple{obj = operation.context, val = l};
var operationCopy := operation.deepclone().oclAsType(qvto::expressions::ImperativeOperation);
assert fatal (operationCopy.context.ctxOwner = operationCopy);
assert fatal (operationCopy.ctx = operationCopy.context);
assert fatal (operationCopy.ctxSequence->first() = operationCopy.context);
assert fatal (operationCopy.ctxMap->get('testContext') = operationCopy.context);
assert fatal (operationCopy.ctx != operation.context);
assert fatal (operationCopy.ctxSequence->first() != operation.context);
assert fatal (operationCopy.ctxMap->get('testContext') != operation.context);
var keyCopy = operationCopy.ctxMap2->keys()->flatten()->first();
assert fatal (keyCopy = operationCopy.context);
assert fatal (operationCopy.ctxMap2->get(List{keyCopy}) = operationCopy.context);
assert fatal (operationCopy.ctxTuple.obj = operationCopy.context);
assert fatal (operationCopy.ctxTuple.val = operationCopy.ctxMap2->keys()->asSequence()->first());
}