Debian Codegraph @

js/src/tests/test262/language/expressions/division/bigint-complex-infinity.js

raw
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 description: BigInt division of complex infinity (1/0)
5 esid: sec-multiplicative-operators-runtime-semantics-evaluation
6 info: |
7 Runtime Semantics: Evaluation
8
9 MultiplicativeExpression: MultiplicativeExpression MultiplicativeOperator ExponentiationExpression
10
11 ...
12 11. If MultiplicativeOperator is /, return T::divide(lnum, rnum).
13 ...
14
15 BigInt::divide (x, y)
16
17 1. If y is 0n, throw a RangeError exception.
18 ...
19 features: [BigInt]
20 ---*/
21 assert.throws(RangeError, function() {
22 1n / 0n;
23 }, '1n / 0n throws RangeError');
24
25 assert.throws(RangeError, function() {
26 10n / 0n;
27 }, '10n / 0n throws RangeError');
28
29 assert.throws(RangeError, function() {
30 0n / 0n;
31 }, '0n / 0n throws RangeError');
32
33 assert.throws(RangeError, function() {
34 1000000000000000000n / 0n;
35 }, '1000000000000000000n / 0n throws RangeError');
36
37 reportCompare(0, 0);