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
9 * Adrien Kirjak – initial implementation
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 ***************************************************/
16 module Sem_160102_predefined_functions_007 {
17 type enumerated MyEnumeratedType {e_black, e_white};
18 type record of integer IntegerList;
20 type record MyRecord {
22 record of integer field2,
24 MyEnumeratedType field4 optional
27 type component GeneralComp {
30 testcase TC_Sem_160102_predefined_functions_007 () runs on GeneralComp {
31 template MyRecord template1 := {
33 field2 := { permutation(2, 3), ? },
37 template MyRecord template2 := {
39 field2 := {permutation(2, 3)},
43 template IntegerList template3 := { 1, 2, 3, * } length(1..3) ;
45 if(lengthof(charstring : "test")!=4) {
46 setverdict(fail, "lengthof(charstring : ""test"")");
48 if (lengthof(universal charstring : "test")!=4) {
49 setverdict(fail, "lengthof(universal charstring : ""test"")");
51 if (lengthof('010'B)!=3) { // STF409: value definitions are interpreted as templates here
52 setverdict(fail, "lengthof('010'B)");
54 if (lengthof('55'H)!=2) { // STF409: value definitions are interpreted as templates here
55 setverdict(fail, "lengthof('55'H)");
57 if (lengthof('55'O)!=1) { // STF409: value definitions are interpreted as templates here
58 setverdict(fail, "lengthof('55'O)");
60 if (lengthof(charstring : pattern "t??t")!=4) {
61 setverdict(fail, "lengthof(charstring : pattern ""t??t"")");
63 if (lengthof(bitstring : '1??1'B)!=4) {
64 setverdict(fail, "lengthof(bitstring : '1??1'B)");
66 if (lengthof(hexstring : '1*1'H length(8))!=8) {
67 setverdict(fail, "lengthof(hexstring : '1*1'H length(8))");
69 if (lengthof(octetstring : '00?FF'O length(3))!=3) {
70 setverdict(fail, "lengthof(octetstring : '00?FF'O length(3))");
72 if (lengthof(octetstring : 'AB?'O)!=2) {
73 setverdict(fail, "lengthof(octetstring : 'AB?'O)");
75 if (sizeof(template1.field2)!=3) {
76 setverdict(fail, "sizeof(", template1.field2, ")");
78 if (sizeof(template2.field2)!=2) {
79 setverdict(fail, "sizeof(", template2.field2, ")");
81 if (lengthof(template3)!=3) {
82 setverdict(fail, "lengthof(", template3, ")");
88 execute(TC_Sem_160102_predefined_functions_007());