jerryscript/tests/jerry/bigint8.js
Szilagyi Adam 4924f9fd31
Remove ES_NEXT macro (#4915)
- remove all '#JERRY_ESNEXT' macro
- remove 5.1 build profile, update test runner accordingly (Note: all builtins are turn on by default)
- move tests from tests/jerry/esnext into tests/jerry, concatenate files with same names
- add skiplist to some snapshot tests that were supported only in 5.1
- fix doxygen issues that were hidden before (bc. of es.next macro)

Co-authored-by: Martin Negyokru negyokru@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2022-01-31 16:46:00 +01:00

56 lines
2.1 KiB
JavaScript

/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Exponentiation
try {
12n ** -7n
assert(false)
} catch (e) {
assert(e instanceof RangeError)
}
assert((0n ** 0n) === 1n)
assert((1n ** 0n) === 1n)
assert(((-2n) ** 0n) === 1n)
assert((1000000000000000000000000000000000n ** 0n) === 1n)
assert(((-1000000000000000000000000000000000n) ** 0n) === 1n)
assert((1n ** 1n) === 1n)
assert((1n ** 10000000000000000000000000000000n) === 1n)
assert(((-1n) ** 1n) === -1n)
assert(((-1n) ** 10000000000000000000000000000000n) === 1n)
assert(((-1n) ** 10000000000000000000000000000001n) === -1n)
assert((2n ** 10n) === 1024n)
assert((2n ** 11n) === 2048n)
assert(((-2n) ** 10n) === 1024n)
assert(((-2n) ** 11n) === -2048n)
assert((2n ** 64n) === 0x10000000000000000n)
assert((2n ** 65n) === 0x20000000000000000n)
assert(((-2n) ** 64n) === 0x10000000000000000n)
assert(((-2n) ** 65n) === -0x20000000000000000n)
assert((2n ** 190n) === 0x400000000000000000000000000000000000000000000000n)
assert((2n ** 191n) === 0x800000000000000000000000000000000000000000000000n)
assert(((-2n) ** 190n) === 0x400000000000000000000000000000000000000000000000n)
assert(((-2n) ** 191n) === -0x800000000000000000000000000000000000000000000000n)
assert((103n ** 32n) === 25750827556851106532658069028441289322166445432839581773436522241n)
assert((103n ** 31n) === 250008034532535014880175427460595041962781023619801764790645847n)
assert(((-79n) ** 32n) === 5297450670659957549009604563595170759963655420038456036451841n)
assert(((-79n) ** 31n) === -67056337603290601886197526121457857721058929367575392866479n)