michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * 1. Evaluate Expression michael@0: * michael@0: * @path ch12/12.13/S12.13_A3_T3.js michael@0: * @description Evaluating number expression michael@0: */ michael@0: michael@0: // CHECK#1 michael@0: try{ michael@0: throw 10+3; michael@0: } michael@0: catch(e){ michael@0: if (e!==13) $ERROR('#1: Exception ===13(operaton +). Actual: Exception ==='+ e); michael@0: } michael@0: michael@0: // CHECK#2 michael@0: var b=10; michael@0: var a=3; michael@0: try{ michael@0: throw a+b; michael@0: } michael@0: catch(e){ michael@0: if (e!==13) $ERROR('#2: Exception ===13(operaton +). Actual: Exception ==='+ e); michael@0: } michael@0: michael@0: // CHECK#3 michael@0: try{ michael@0: throw 3.15-1.02; michael@0: } michael@0: catch(e){ michael@0: if (e!==2.13) $ERROR('#3: Exception ===2.13(operaton -). Actual: Exception ==='+ e); michael@0: } michael@0: michael@0: // CHECK#4 michael@0: try{ michael@0: throw 2*2; michael@0: } michael@0: catch(e){ michael@0: if (e!==4) $ERROR('#4: Exception ===4(operaton *). Actual: Exception ==='+ e); michael@0: } michael@0: michael@0: // CHECK#5 michael@0: try{ michael@0: throw 1+Infinity; michael@0: } michael@0: catch(e){ michael@0: if (e!==+Infinity) $ERROR('#5: Exception ===+Infinity(operaton +). Actual: Exception ==='+ e); michael@0: } michael@0: michael@0: // CHECK#6 michael@0: try{ michael@0: throw 1-Infinity; michael@0: } michael@0: catch(e){ michael@0: if (e!==-Infinity) $ERROR('#6: Exception ===-Infinity(operaton -). Actual: Exception ==='+ e); michael@0: } michael@0: michael@0: // CHECK#7 michael@0: try{ michael@0: throw 10/5; michael@0: } michael@0: catch(e){ michael@0: if (e!==2) $ERROR('#7: Exception ===2(operaton /). Actual: Exception ==='+ e); michael@0: } michael@0: michael@0: // CHECK#8 michael@0: try{ michael@0: throw 8>>2; michael@0: } michael@0: catch(e){ michael@0: if (e!==2) $ERROR('#8: Exception ===2(operaton >>). Actual: Exception ==='+ e); michael@0: } michael@0: michael@0: // CHECK#9 michael@0: try{ michael@0: throw 2<<2; michael@0: } michael@0: catch(e){ michael@0: if (e!==8) $ERROR('#9: Exception ===8(operaton <<). Actual: Exception ==='+ e); michael@0: } michael@0: michael@0: // CHECK#10 michael@0: try{ michael@0: throw 123%100; michael@0: } michael@0: catch(e){ michael@0: if (e!==23) $ERROR('#10: Exception ===23(operaton %). Actual: Exception ==='+ e); michael@0: } michael@0: