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_019.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 predefined decvalue function works properly in case of decoding failure
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
15
16 // The following requirements are tested:
17 // (C.5.2)
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
22 // decoding below:
23 // â\80¢ The return value 1 indicates an unspecified cause of decoding failure.
24
25 module Sem_160102_predefined_functions_019 {
26 type enumerated E { one(1), two(2), three(3) } with { variant "32 bit"};
27
28 type component GeneralComp {
29 }
30
31 testcase TC_Sem_160102_predefined_functions_019 () runs on GeneralComp {
32 var bitstring v_test := int2bit(0, 32);
33 var E v_decoded;
34 var integer v_res := decvalue(v_test, v_decoded);
35 // expected result:
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)) {
40 setverdict(pass);
41 } else {
42 setverdict(fail, "Unexpected decoding result");
43 }
44 }
45
46 control{
47 execute(TC_Sem_160102_predefined_functions_019());
48 }
49 }
This page took 0.039828 seconds and 5 git commands to generate.