Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/addition/S11.6.1_A3.1_T2.4.js

raw
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 If Type(Primitive(x)) is not String and Type(Primitive(y)) is not String,
7 then operator x + y returns ToNumber(x) + ToNumber(y)
8 es5id: 11.6.1_A3.1_T2.4
9 description: >
10 Type(Primitive(x)) is different from Type(Primitive(y)) and both
11 types vary between Boolean (primitive or object) and Undefined
12 ---*/
13
14 //CHECK#1
15 if (isNaN(true + undefined) !== true) {
16 $ERROR('#1: true + undefined === Not-a-Number. Actual: ' + (true + undefined));
17 }
18
19 //CHECK#2
20 if (isNaN(undefined + true) !== true) {
21 $ERROR('#2: undefined + true === Not-a-Number. Actual: ' + (undefined + true));
22 }
23
24 //CHECK#3
25 if (isNaN(new Boolean(true) + undefined) !== true) {
26 $ERROR('#3: new Boolean(true) + undefined === Not-a-Number. Actual: ' + (new Boolean(true) + undefined));
27 }
28
29 //CHECK#4
30 if (isNaN(undefined + new Boolean(true)) !== true) {
31 $ERROR('#4: undefined + new Boolean(true) === Not-a-Number. Actual: ' + (undefined + new Boolean(true)));
32 }