conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 07_expressions / 0701_operators / 070101_arithmetic_operators / Sem_070101_ArithmeticOperators_021.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:7.1.1, Ensure that the multiplication operator works on float variables.
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
15
16 module Sem_070101_ArithmeticOperators_021 {
17
18 type component GeneralComp {
19 }
20
21 /**
22 * @desc Equals method for floats
23 * @return true if abs(f1 - f2) < 1.E-6
24 */
25 function f_isFloatNear(in float f1, in float f2) return boolean {
26 var float delta := f1-f2;
27 if (delta < 0.0) {
28 delta := 0.0 - delta;
29 }
30 return delta < 1E-6;
31 }
32
33 testcase TC_Sem_070101_ArithmeticOperators_021() runs on GeneralComp {
34 var float v_i := 10.2;
35 var float v_j := 0.4;
36 var float v_result := v_i * v_j;
37
38 if ( f_isFloatNear(v_result,4.08) ) {
39 setverdict(pass);
40 } else {
41 setverdict(fail);
42 }
43 }
44
45 control{
46 execute(TC_Sem_070101_ArithmeticOperators_021());
47 }
48
49 }
This page took 0.032383 seconds and 5 git commands to generate.