Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/subtraction/S11.6.2_A3_T2.3.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: Operator x - y returns ToNumber(x) - ToNumber(y)
6 es5id: 11.6.2_A3_T2.3
7 description: >
8 Type(x) is different from Type(y) and both types vary between
9 Number (primitive or object) and Null
10 ---*/
11
12 //CHECK#1
13 if (1 - null !== 1) {
14 $ERROR('#1: 1 - null === 1. Actual: ' + (1 - null));
15 }
16
17 //CHECK#2
18 if (null - 1 !== -1) {
19 $ERROR('#2: null - 1 === -1. Actual: ' + (null - 1));
20 }
21
22 //CHECK#3
23 if (new Number(1) - null !== 1) {
24 $ERROR('#3: new Number(1) - null === 1. Actual: ' + (new Number(1) - null));
25 }
26
27 //CHECK#4
28 if (null - new Number(1) !== -1) {
29 $ERROR('#4: null - new Number(1) === -1. Actual: ' + (null - new Number(1)));
30 }