conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 16_functions_altsteps_testcases / 1601_functions / 160102_predefined_functions / Sem_160102_predefined_functions_007.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:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C)
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
15
16 module Sem_160102_predefined_functions_007 {
17 type enumerated MyEnumeratedType {e_black, e_white};
18 type record of integer IntegerList;
19
20 type record MyRecord {
21 boolean field1,
22 record of integer field2,
23 integer field3,
24 MyEnumeratedType field4 optional
25 }
26
27 type component GeneralComp {
28 }
29
30 testcase TC_Sem_160102_predefined_functions_007 () runs on GeneralComp {
31 template MyRecord template1 := {
32 field1 := true,
33 field2 := { permutation(2, 3), ? },
34 field3 := 5,
35 field4 := omit
36 }
37 template MyRecord template2 := {
38 field1 := true,
39 field2 := {permutation(2, 3)},
40 field3 := 6,
41 field4 := omit
42 }
43 template IntegerList template3 := { 1, 2, 3, * } length(1..3) ;
44
45 if(lengthof(charstring : "test")!=4) {
46 setverdict(fail, "lengthof(charstring : ""test"")");
47 }
48 if (lengthof(universal charstring : "test")!=4) {
49 setverdict(fail, "lengthof(universal charstring : ""test"")");
50 }
51 if (lengthof('010'B)!=3) { // STF409: value definitions are interpreted as templates here
52 setverdict(fail, "lengthof('010'B)");
53 }
54 if (lengthof('55'H)!=2) { // STF409: value definitions are interpreted as templates here
55 setverdict(fail, "lengthof('55'H)");
56 }
57 if (lengthof('55'O)!=1) { // STF409: value definitions are interpreted as templates here
58 setverdict(fail, "lengthof('55'O)");
59 }
60 if (lengthof(charstring : pattern "t??t")!=4) {
61 setverdict(fail, "lengthof(charstring : pattern ""t??t"")");
62 }
63 if (lengthof(bitstring : '1??1'B)!=4) {
64 setverdict(fail, "lengthof(bitstring : '1??1'B)");
65 }
66 if (lengthof(hexstring : '1*1'H length(8))!=8) {
67 setverdict(fail, "lengthof(hexstring : '1*1'H length(8))");
68 }
69 if (lengthof(octetstring : '00?FF'O length(3))!=3) {
70 setverdict(fail, "lengthof(octetstring : '00?FF'O length(3))");
71 }
72 if (lengthof(octetstring : 'AB?'O)!=2) {
73 setverdict(fail, "lengthof(octetstring : 'AB?'O)");
74 }
75 if (sizeof(template1.field2)!=3) {
76 setverdict(fail, "sizeof(", template1.field2, ")");
77 }
78 if (sizeof(template2.field2)!=2) {
79 setverdict(fail, "sizeof(", template2.field2, ")");
80 }
81 if (lengthof(template3)!=3) {
82 setverdict(fail, "lengthof(", template3, ")");
83 }
84 setverdict(pass);
85 }
86
87 control{
88 execute(TC_Sem_160102_predefined_functions_007());
89 }
90 }
This page took 0.033436 seconds and 5 git commands to generate.