Commit 6b791b8d authored by Matthias Simon's avatar Matthias Simon
Browse files

Add PassByReference test

parent 1e01b46b
Loading
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
// @verdict: pass accept, ttcn3verdict:pass
// @purpose: Assure that resizing references does not break execution.
module PassByReference {

	type record of integer RoI;

	testcase reallocation() runs on C {
		var RoI a := {1,2,3}
		resize(a[0], a);
		if (match(a, {111, 2, 3, * , 999})) {
			setverdict(pass)
		}
	}

	function resize(inout integer i, inout RoI a) {
		// force a reallocation
		a[4096] := 999;

		// update old reference
		i := 111;
	}

	type component C {}
	control {
		execute(reallocation());
	}
}