conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 05_basic_language_elements / 0505_cyclic_definitions / Sem_0505_cyclic_definitions_003.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Adrien Kirjak – initial implementation
10 *
11 ** @version 0.0.1
12 ** @purpose 1:5.5, Verify that cyclic import containing cyclic function calls is allowed
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
15
16 // The following requirements are tested:
17 // Direct and indirect cyclic definitions are not allowed with the exception of the
18 // following cases:
19 // a) for recursive type definitions (see clause 6.2);
20 // b) function and altstep definitions (i.e. recursive function or altstep calls);
21 // c) cyclic import definitions, if the imported definitions only form allowed cyclic
22 // definitions.
23 // In particular, the combination of c and b is tested
24
25 module Sem_0505_cyclic_definitions_003 {
26 import from Sem_0505_cyclic_definitions_003_import { function f_factImp; }
27 type component GeneralComp {
28 }
29
30 function f_fact(integer p_argument) return integer {
31 if(p_argument==0) {
32 return 1;
33 }
34 else {
35 return p_argument*f_factImp(p_argument-1);
36 }
37 }
38
39 testcase TC_Sem_0505_cyclic_definitions_003() runs on GeneralComp {
40 if (f_fact(10) == 3628800) { // checks 10!
41 setverdict(pass);
42 }
43 else {
44 setverdict(fail);
45 }
46 }
47
48 control{
49 execute(TC_Sem_0505_cyclic_definitions_003());
50 }
51
52 }
53
This page took 0.041427 seconds and 5 git commands to generate.