S9.3.1_A4_T2.js (969B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 The MV of StrDecimalLiteral::: + StrUnsignedDecimalLiteral is the MV of 7 StrUnsignedDecimalLiteral 8 es5id: 9.3.1_A4_T2 9 description: Compare Number('+' + 'any_number') with Number('any_number') 10 ---*/ 11 12 function dynaString(s1, s2) { 13 return String(s1) + String(s2); 14 } 15 16 assert.sameValue( 17 Number(dynaString("+", "0")), 18 0 19 ); 20 21 assert.sameValue( 22 Number(dynaString("+Infi", "nity")), 23 Infinity 24 ); 25 26 assert.sameValue( 27 Number(dynaString("+1234.", "5678")), 28 1234.5678 29 ); 30 31 assert.sameValue( 32 Number(dynaString("+1234.", "5678e90")), 33 1234.5678e90 34 ); 35 36 assert.sameValue( 37 Number(dynaString("+1234.", "5678E90")), 38 1234.5678E90 39 ); 40 41 assert.sameValue( 42 Number(dynaString("+1234.", "5678e-90")), 43 1234.5678e-90 44 ); 45 46 assert.sameValue( 47 Number(dynaString("+1234.", "5678E-90")), 48 1234.5678E-90 49 ); 50 51 reportCompare(0, 0);