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 predefined decvalue function works properly in case of decoding failure
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
16 // The following requirements are tested:
18 // The decvalue function decodes a bitstring into a value. The test system shall suppose that
19 // the bitstring encoded_value represents an encoded instance of the actual type of decoded_value.
20 // If the decoding was unsuccessful, the actual parameters for encoded_value and decoded_value are
21 // not changed. The function shall return an integer value to indicate success or failure of the
23 // â
\80¢ The return value 1 indicates an unspecified cause of decoding failure.
25 module Sem_160102_predefined_functions_019 {
26 type enumerated E { one(1), two(2), three(3) } with { variant "32 bit"};
28 type component GeneralComp {
31 testcase TC_Sem_160102_predefined_functions_019 () runs on GeneralComp {
32 var bitstring v_test := int2bit(0, 32);
34 var integer v_res := decvalue(v_test, v_decoded);
36 // v_res: 1 (failure, unspecified) -> no named value corresponding to ordinal number 0
37 // v_decoded: uninitialized
38 // v_test: original 32-bit value
39 if (match(v_res, 1) and not isbound(v_decoded) and match(lengthof(v_test), 32)) {
42 setverdict(fail, "Unexpected decoding result");
47 execute(TC_Sem_160102_predefined_functions_019());