/****************************************************************************** * Copyright (c) 2000-2014 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html ******************************************************************************/ module subtype_SE { //^In TTCN-3 module// import from subtype_OK all; type component floater {} 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\)$// 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\)$// type float buzz_lightyear (infinity .. not_a_number) //^In type definition// //^error: upper boundary cannot be not_a_number in float subtype range$// // to infinity and beyond type su3 su3bis (6.0 .. 10.0); type float one_to_ten (1.0 .. 10.0) type float ten_to_eleven (10.0 .. 11.0) // The real axis: -infinity -0.0 0.0 +infinity type float strict_neg_x (-infinity .. !-0.0) //[.............) type float strict_neg (-infinity .. -0.0) //[.............] type float neg0_x (-infinity .. ! 0.0) //[.................) type float neg0 (-infinity .. 0.0) //[.................] type float pos ( -0.0 .. infinity) // [................] type float pos_x (!-0.0 .. infinity) // (................] type float strict_pos ( 0.0 .. infinity) // [...........] type float strict_pos_x (! 0.0 .. infinity) // (...........] type float zero ( -0.0 .. 0.0) // two values type float xzero (!-0.0 .. 0.0) // one value: 0.0 type float zerox( -0.0 .. !0.0) // one value: -0.0 type float xzerox(!-0.0 .. !0.0) // no values! testcase negative() runs on floater //^In testcase definition// { 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\)$// 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\)$// var strict_neg sn_minus_0 := -0.0; // OK 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\)$// var neg0_x n0x_minus_0 := -0.0; // OK 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\)$// var neg0 nz_minus_zero := -0.0; // OK var neg0 nz_plus_zero := 0.0; // OK } testcase positive() runs on floater //^In testcase definition// { var pos p_minus_0 := -0.0 // OK var pos p_plus_0 := 0.0 // OK 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\)$// var pos_x px_plus_0 := 0.0 // OK 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\)$// var strict_pos sp_0 := 0.0 // OK 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\)$// 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\)$// } testcase nulla() runs on floater { var zero minus_zero := -0.0; // OK var zero plus_zero := 0.0; // OK } control { //^In control part:$ nothing right now var one_to_ten six := 6.6; var ten_to_eleven ten := six; execute(negative()); execute(positive()); execute(nulla()); } }