diff options
Diffstat (limited to 'js/src/jit-test/tests/ion/compare-string.js')
-rw-r--r-- | js/src/jit-test/tests/ion/compare-string.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/compare-string.js b/js/src/jit-test/tests/ion/compare-string.js new file mode 100644 index 000000000..5edf3c04c --- /dev/null +++ b/js/src/jit-test/tests/ion/compare-string.js @@ -0,0 +1,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(); +} |