Commit 686edc2c authored by Matthias Simon's avatar Matthias Simon
Browse files

Update section 11 and 12

parent c600d837
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -22,12 +22,13 @@ differences:
> inference rules, ...

> NOTE: A tool is permitted to implement optimizations, such as pre-computing
> values, moving expensive expression out of the loop as long TTCN-3 semantics
> are not violated.
> values, lazy-evaluation, or moving expensive expression out of the loop as
> long TTCN-3 semantics are not violated.

> NOTE: A tool vendor is permitted to forbid the use of constant as call by
> reference parameters.


**Examples**

```ttcn3 example = "required initial value assignment"
+24 −2
Original line number Diff line number Diff line
@@ -15,11 +15,10 @@ The rules for module parameters are the same as for [variables], with following
differences:

- a module parameter may be declared in a module scope, only.
- a module parameter shall be assigned a value, not once per lifetime, but once per [test run].
- a module parameter shall be assigned a value, only once per [test run].
- the value can be provided by the test environment during runtime.



**Examples**

```ttcn3 example = "module parameters"
@@ -34,3 +33,26 @@ module M {
    modulepar template integer i, j[3] := {1,2,3}
}
```

```ttcn3 example = "evaluated once per test run"
module M {
    modulepar integer mpar;

    testcase tc(in integer i) {
        if (i == mpar) {
            setverdict(pass)
        } else {
            setverdict(fail)
        }
    }

    // the control part executes a test multiple times, however module
    // parameter `mpar` is evaluated only once during this run and returns the
    // same value everytime it is referenced.
    control {
        var integer i := mpar;
        execute(tc(i));
        execute(tc(i));
    }
}
```