summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/compare-string.js
blob: 5edf3c04c8df2793c3f6eacc10c2e7b9103109b7 (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
function compareToAtom(a) {
    return a == 'test';
}

function compareToAtomNe(a) {
    return a != 'test';
}

var st = 'st';

function compareToRope(a) {
    return a == ('te' + st);
}

function compareToRopeNe(a) {
    var st = 'st';
    return a != ('te' + st);
}

function main() {
    var test = 'test';
    var foobar = 'foobar';

    assertEq(compareToAtom(test), true);
    assertEq(compareToAtom(foobar), false);

    assertEq(compareToAtomNe(test), false);
    assertEq(compareToAtomNe(foobar), true);


    assertEq(compareToRope(test), true);
    assertEq(compareToRope(foobar), false);

    assertEq(compareToRopeNe(test), false);
    assertEq(compareToRopeNe(foobar), true);
}

for (var i = 0; i < 100000; i++) {
    main();
}