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 performs decoding if there are more bits than needed
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 successful, then the used bits are removed from the parameter encoded_value,
21 // the rest is returned (in the parameter encoded_value), and the decoded value is returned
22 // in the parameter decoded_value. The function shall return an integer value to indicate success
23 // or failure of the decoding below:
24 // â
\80¢ The return value 0 indicates that decoding was successful.
26 module Sem_160102_predefined_functions_018 {
27 type integer I with { variant "32 bit"};
29 type component GeneralComp {
32 testcase TC_Sem_160102_predefined_functions_018 () runs on GeneralComp {
33 const bitstring c_suffix := '11111111'B;
34 var bitstring v_test := int2bit(0, 32) & c_suffix; // 8 excess bits
36 var integer v_res := decvalue(v_test, v_decoded);
40 // v_test: '11111111'B (8 excess bits shall be returned)
41 if (match(v_res, 0) and match(v_decoded, 0) and match(v_test, c_suffix)) {
44 setverdict(fail, "Unexpected decoding result");
49 execute(TC_Sem_160102_predefined_functions_018());