| 1 |
// Copyright (C) 2017 Robin Templeton. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
description: Conversion of BigInt values to booleans |
| 6 |
esid: sec-logical-not-operator-runtime-semantics-evaluation |
| 7 |
info: | |
| 8 |
UnaryExpression: ! UnaryExpression |
| 9 |
|
| 10 |
1. Let expr be the result of evaluating UnaryExpression. |
| 11 |
2. Let oldValue be ToBoolean(? GetValue(expr)). |
| 12 |
3. If oldValue is true, return false. |
| 13 |
4. Return true. |
| 14 |
|
| 15 |
ToBoolean ( argument ) |
| 16 |
|
| 17 |
BigInt: Return false if argument is 0n; otherwise return true. |
| 18 |
features: [BigInt] |
| 19 |
---*/ |
| 20 |
|
| 21 |
assert.sameValue(!0n, true, "!0n"); |
| 22 |
assert.sameValue(!1n, false, "!1n"); |
| 23 |
assert.sameValue(!-1n, false, "!-1n"); |