1 /******************************************************************************
2 * Copyright (c) 2000-2014 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 module subtype_SE { //^In TTCN-3 module//
9 import from subtype_OK all;
11 type component floater {}
13 type myf123 su2 (3.14); //^In type definition// //^error: The subtype restriction is not a subset of the restriction on the parent type\. Subtype \(3\.14e0\) is not subset of subtype \(1\.0e0,2\.0e0,3\.0e0\)$//
14 type minf_to_zero su3 (!6.0 .. 10.0); //^In type definition// //^error: The subtype restriction is not a subset of the restriction on the parent type\. Subtype \(!6\.0e0\.\.1\.0e1\) is not subset of subtype \(-INF\.\.0\.0e0\)$//
16 type float buzz_lightyear (infinity .. not_a_number) //^In type definition// //^error: upper boundary cannot be not_a_number in float subtype range$//
17 // to infinity and beyond
19 type su3 su3bis (6.0 .. 10.0);
21 type float one_to_ten (1.0 .. 10.0)
22 type float ten_to_eleven (10.0 .. 11.0)
24 // The real axis: -infinity -0.0 0.0 +infinity
25 type float strict_neg_x (-infinity .. !-0.0) //[.............)
26 type float strict_neg (-infinity .. -0.0) //[.............]
27 type float neg0_x (-infinity .. ! 0.0) //[.................)
28 type float neg0 (-infinity .. 0.0) //[.................]
30 type float pos ( -0.0 .. infinity) // [................]
31 type float pos_x (!-0.0 .. infinity) // (................]
32 type float strict_pos ( 0.0 .. infinity) // [...........]
33 type float strict_pos_x (! 0.0 .. infinity) // (...........]
35 type float zero ( -0.0 .. 0.0) // two values
36 type float xzero (!-0.0 .. 0.0) // one value: 0.0
37 type float zerox( -0.0 .. !0.0) // one value: -0.0
38 type float xzerox(!-0.0 .. !0.0) // no values!
40 testcase negative() runs on floater //^In testcase definition//
42 var strict_neg_x snx_minus_0 := -0.0; //^In variable definition// //^error: -0\.0e0 is not a valid value for type \`float\' which has subtype \(-INF\.\.!-0\.0e0\)$//
43 var strict_neg_x snx_plus_0 := 0.0; //^In variable definition// //^error: 0\.0e0 is not a valid value for type \`float\' which has subtype \(-INF\.\.!-0\.0e0\)$//
45 var strict_neg sn_minus_0 := -0.0; // OK
46 var strict_neg sn_plus_0 := 0.0; //^In variable definition// //^error: 0\.0e0 is not a valid value for type \`float\' which has subtype \(-INF\.\.-0\.0e0\)$//
48 var neg0_x n0x_minus_0 := -0.0; // OK
49 var neg0_x n0x_plus_0 := 0.0; //^In variable definition// //^error: 0\.0e0 is not a valid value for type \`float\' which has subtype \(-INF\.\.!0\.0e0\)$//
51 var neg0 nz_minus_zero := -0.0; // OK
52 var neg0 nz_plus_zero := 0.0; // OK
55 testcase positive() runs on floater //^In testcase definition//
57 var pos p_minus_0 := -0.0 // OK
58 var pos p_plus_0 := 0.0 // OK
60 var pos_x px_minus_0 := -0.0 //^In variable definition// //^error: -0\.0e0 is not a valid value for type \`float\' which has subtype \(!-0\.0e0\.\.INF\)$//
61 var pos_x px_plus_0 := 0.0 // OK
63 var strict_pos sp_minus_0 := -0.0 //^In variable definition// //^error: -0\.0e0 is not a valid value for type \`float\' which has subtype \(0\.0e0\.\.INF\)$//
64 var strict_pos sp_0 := 0.0 // OK
66 var strict_pos_x spx_minus_0 := -0.0 //^In variable definition// //^error: -0\.0e0 is not a valid value for type \`float\' which has subtype \(!0\.0e0\.\.INF\)$//
67 var strict_pos_x spx_plus_0 := 0.0 //^In variable definition// //^error: 0\.0e0 is not a valid value for type \`float\' which has subtype \(!0\.0e0\.\.INF\)$//
70 testcase nulla() runs on floater
72 var zero minus_zero := -0.0; // OK
73 var zero plus_zero := 0.0; // OK
76 control { //^In control part:$ nothing right now
77 var one_to_ten six := 6.6;
78 var ten_to_eleven ten := six;