Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/unary-minus/bigint.js

raw
1 // Copyright (C) 2017 Josh Wolfe. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: Unary minus for BigInt values
6 esid: sec-numeric-types-bigint-unaryMinus
7 info: |
8 BigInt::unaryMinus (x)
9
10 The abstract operation BigInt::unaryMinus with an argument x of BigInt type returns the result of negating x.
11
12 Note: There is only one 0n value; -0n is the same as 0n.
13
14 features: [BigInt]
15 ---*/
16
17 assert.sameValue(-0n, 0n, "-0n === 0n");
18 assert.sameValue(-(0n), 0n, "-(0n) === 0n");
19 assert.notSameValue(-1n, 1n, "-1n !== 1n");
20 assert.sameValue(-(1n), -1n, "-(1n) === -1n");
21 assert.notSameValue(-(1n), 1n, "-(1n) !== 1n");
22 assert.sameValue(-(-1n), 1n, "-(-1n) === 1n");
23 assert.notSameValue(-(-1n), -1n, "-(-1n) !== -1n");
24 assert.sameValue(- - 1n, 1n, "- - 1n === 1n");
25 assert.notSameValue(- - 1n, -1n, "- - 1n !== -1n");
26 assert.sameValue(
27 -(0x1fffffffffffff01n), -0x1fffffffffffff01n,
28 "-(0x1fffffffffffff01n) === -0x1fffffffffffff01n");
29 assert.notSameValue(
30 -(0x1fffffffffffff01n), 0x1fffffffffffff01n,
31 "-(0x1fffffffffffff01n) !== 0x1fffffffffffff01n");
32 assert.notSameValue(
33 -(0x1fffffffffffff01n), -0x1fffffffffffff00n,
34 "-(0x1fffffffffffff01n) !== -0x1fffffffffffff00n");