• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/*
17 * @tc.name:BigInt
18 * @tc.desc:test BigInt
19 * @tc.type: FUNC
20 * @tc.require: issueI7DG0J
21 */
22
23try {
24    BigInt.asUintN(2147483649, -1873965464n);
25} catch (e) {
26    print("test successful");
27}
28
29const n1 = Number(0x1fffeffafbfcfen);
30print(n1);
31
32try {
33    print((9007199254740991n + 9007199254740991n) ** 0n);
34    print(0n ** (9007199254740991n + 9007199254740991n));
35    print((9007199254740991n + 9007199254740991n) ** 9007199254740991n);
36} catch (err) {
37    print(err.name);
38}
39
40try {
41    print(0x4141414141414141n << 0n);
42    print(0n << 0x4141414141414141n);
43    print(0x4141414141414141n << 0x4141414141414141n);
44} catch (err) {
45    print(err.name);
46}
47
48try {
49    const atom = this.Atomics;
50    atom.and(new BigInt64Array(3807), atom, atom);
51} catch (err) {
52    print(err.name)
53}
54
55const v33 = String.fromCharCode(48).padStart(48, String.fromCharCode(48));
56const v35 = [-1073741824, 2, -9007199254740992];
57const v42 = Symbol.toPrimitive;
58Symbol.for(v42.description);
59function f36(a37, a38) {
60    try {
61        a37.lastIndexOf(0);
62    } catch (err) {
63        print(err);
64    }
65    return v33;
66}
67v35[v42] = f36;
68let v49 = -12n;
69v49--;
70const v52 = (v49 >> v49).constructor;
71const t48 = v52.__defineSetter__;
72print(v52(v35));