aboutsummaryrefslogtreecommitdiff
path: root/test/compress/bigint.js
blob: 9c21d083bf2c777c8a45ff1562eaaff47e4c464c (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
arithmetic: {
    input: {
        console.log(((1n + 0x2n) * (0o3n - -4n)) >> (5n - 6n));
    }
    expect_exact: "console.log((1n+0x2n)*(0o3n- -4n)>>5n-6n);"
    expect_stdout: "42n"
    node_version: ">=10"
}

minus_dot: {
    input: {
        console.log(typeof -42n.toString(), typeof (-42n).toString());
    }
    expect_exact: "console.log(typeof-42n.toString(),typeof(-42n).toString());"
    expect_stdout: "number string"
    node_version: ">=10"
}

evaluate: {
    options = {
        evaluate: true,
        unsafe: true,
    }
    input: {
        console.log((0xDEAD_BEEFn).toString(16));
    }
    expect: {
        console.log(0xdeadbeefn.toString(16));
    }
    expect_stdout: "deadbeef"
    node_version: ">=10"
}

Number: {
    options = {
        unsafe: true,
    }
    input: {
        console.log(Number(-0xfeed_dead_beef_badn));
    }
    expect: {
        console.log(+("" + -0xfeed_dead_beef_badn));
    }
    expect_stdout: "-1148098955808013200"
    node_version: ">=10"
}

issue_4590: {
    options = {
        collapse_vars: true,
    }
    input: {
        A = 1;
        0n || console.log("PASS");
    }
    expect: {
        A = 1;
        0n || console.log("PASS");
    }
    expect_stdout: "PASS"
    node_version: ">=10"
}