| 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: 1. Evaluate Expression |
| 6 |
es5id: 12.13_A3_T3 |
| 7 |
description: Evaluating number expression |
| 8 |
---*/ |
| 9 |
|
| 10 |
// CHECK#1 |
| 11 |
try{ |
| 12 |
throw 10+3; |
| 13 |
} |
| 14 |
catch(e){ |
| 15 |
if (e!==13) throw new Test262Error('#1: Exception ===13(operaton +). Actual: Exception ==='+ e); |
| 16 |
} |
| 17 |
|
| 18 |
// CHECK#2 |
| 19 |
var b=10; |
| 20 |
var a=3; |
| 21 |
try{ |
| 22 |
throw a+b; |
| 23 |
} |
| 24 |
catch(e){ |
| 25 |
if (e!==13) throw new Test262Error('#2: Exception ===13(operaton +). Actual: Exception ==='+ e); |
| 26 |
} |
| 27 |
|
| 28 |
// CHECK#3 |
| 29 |
try{ |
| 30 |
throw 3.15-1.02; |
| 31 |
} |
| 32 |
catch(e){ |
| 33 |
if (e!==2.13) throw new Test262Error('#3: Exception ===2.13(operaton -). Actual: Exception ==='+ e); |
| 34 |
} |
| 35 |
|
| 36 |
// CHECK#4 |
| 37 |
try{ |
| 38 |
throw 2*2; |
| 39 |
} |
| 40 |
catch(e){ |
| 41 |
if (e!==4) throw new Test262Error('#4: Exception ===4(operaton *). Actual: Exception ==='+ e); |
| 42 |
} |
| 43 |
|
| 44 |
// CHECK#5 |
| 45 |
try{ |
| 46 |
throw 1+Infinity; |
| 47 |
} |
| 48 |
catch(e){ |
| 49 |
if (e!==+Infinity) throw new Test262Error('#5: Exception ===+Infinity(operaton +). Actual: Exception ==='+ e); |
| 50 |
} |
| 51 |
|
| 52 |
// CHECK#6 |
| 53 |
try{ |
| 54 |
throw 1-Infinity; |
| 55 |
} |
| 56 |
catch(e){ |
| 57 |
if (e!==-Infinity) throw new Test262Error('#6: Exception ===-Infinity(operaton -). Actual: Exception ==='+ e); |
| 58 |
} |
| 59 |
|
| 60 |
// CHECK#7 |
| 61 |
try{ |
| 62 |
throw 10/5; |
| 63 |
} |
| 64 |
catch(e){ |
| 65 |
if (e!==2) throw new Test262Error('#7: Exception ===2(operaton /). Actual: Exception ==='+ e); |
| 66 |
} |
| 67 |
|
| 68 |
// CHECK#8 |
| 69 |
try{ |
| 70 |
throw 8>>2; |
| 71 |
} |
| 72 |
catch(e){ |
| 73 |
if (e!==2) throw new Test262Error('#8: Exception ===2(operaton >>). Actual: Exception ==='+ e); |
| 74 |
} |
| 75 |
|
| 76 |
// CHECK#9 |
| 77 |
try{ |
| 78 |
throw 2<<2; |
| 79 |
} |
| 80 |
catch(e){ |
| 81 |
if (e!==8) throw new Test262Error('#9: Exception ===8(operaton <<). Actual: Exception ==='+ e); |
| 82 |
} |
| 83 |
|
| 84 |
// CHECK#10 |
| 85 |
try{ |
| 86 |
throw 123%100; |
| 87 |
} |
| 88 |
catch(e){ |
| 89 |
if (e!==23) throw new Test262Error('#10: Exception ===23(operaton %). Actual: Exception ==='+ e); |
| 90 |
} |
| 91 |
|
| 92 |
reportCompare(0, 0); |