/*****************************************************************
 ** @author  STF 572
 ** @version 0.0.1
 ** @purpose 5.1.1.0, Ensure that passing of object references to the create operation of a component type or a function started on another component is not allowed.
 ** @verdict pass reject
*****************************************************************/
module NegSem_50101_top_level_004 "TTCN-3:2018 Object-Oriented" {

    type component GeneralComp {

    }

    type component MyNotEmptyComponent{
        const charstring c_MyCstr := "def";

        function doSomething(in MyEmptyClass e) {
            log("Nothing in MyEmptyClass e");
        }
    }

    public type class MyEmptyClass runs on GeneralComp {

    }

    testcase TC_NegSem_50101_top_level_004_01() runs on GeneralComp {
        var MyEmptyClass v_MyClass := MyEmptyClass.create();
        var GeneralComp v_MyComponent := GeneralComp.create(v_MyClass); //not allowed
        setverdict(pass);
    }

    testcase TC_NegSem_50101_top_level_004_02() runs on GeneralComp {
        var MyEmptyClass v_MyClass := MyEmptyClass.create();
        var MyNotEmptyComponent v_MyComponent := MyNotEmptyComponent.create alive;
        v_MyComponent.start(doSomething(v_MyClass)); //not allowed
        setverdict(pass);
    }

    control {
        execute(TC_NegSem_50101_top_level_004_01());
        execute(TC_NegSem_50101_top_level_004_02());
    }
}