diff options
Diffstat (limited to 'test/compress/assignment.js')
-rw-r--r-- | test/compress/assignment.js | 238 |
1 files changed, 238 insertions, 0 deletions
diff --git a/test/compress/assignment.js b/test/compress/assignment.js new file mode 100644 index 00000000..903380a9 --- /dev/null +++ b/test/compress/assignment.js @@ -0,0 +1,238 @@ +op_equals_left_local_var: { + options = { + evaluate: true, + } + input: { + var x; + + x = x + 3; + x = x - 3; + x = x / 3; + x = x * 3; + x = x >> 3; + x = x << 3; + x = x >>> 3; + x = x | 3; + x = x ^ 3; + x = x % 3; + x = x & 3; + + x = x + g(); + x = x - g(); + x = x / g(); + x = x * g(); + x = x >> g(); + x = x << g(); + x = x >>> g(); + x = x | g(); + x = x ^ g(); + x = x % g(); + x = x & g(); + } + expect: { + var x; + + x += 3; + x -= 3; + x /= 3; + x *= 3; + x >>= 3; + x <<= 3; + x >>>= 3; + x |= 3; + x ^= 3; + x %= 3; + x &= 3; + + x += g(); + x -= g(); + x /= g(); + x *= g(); + x >>= g(); + x <<= g(); + x >>>= g(); + x |= g(); + x ^= g(); + x %= g(); + x &= g(); + } +} + +op_equals_right_local_var: { + options = { + evaluate: true, + } + input: { + var x; + + x = (x -= 2) ^ x; + + x = 3 + x; + x = 3 - x; + x = 3 / x; + x = 3 * x; + x = 3 >> x; + x = 3 << x; + x = 3 >>> x; + x = 3 | x; + x = 3 ^ x; + x = 3 % x; + x = 3 & x; + + x = g() + x; + x = g() - x; + x = g() / x; + x = g() * x; + x = g() >> x; + x = g() << x; + x = g() >>> x; + x = g() | x; + x = g() ^ x; + x = g() % x; + x = g() & x; + } + expect: { + var x; + + x = (x -= 2) ^ x; + + x = 3 + x; + x = 3 - x; + x = 3 / x; + x *= 3; + x = 3 >> x; + x = 3 << x; + x = 3 >>> x; + x |= 3; + x ^= 3; + x = 3 % x; + x &= 3; + + x = g() + x; + x = g() - x; + x = g() / x; + x = g() * x; + x = g() >> x; + x = g() << x; + x = g() >>> x; + x = g() | x; + x = g() ^ x; + x = g() % x; + x = g() & x; + } +} +op_equals_left_global_var: { + options = { + evaluate: true, + } + input: { + x = x + 3; + x = x - 3; + x = x / 3; + x = x * 3; + x = x >> 3; + x = x << 3; + x = x >>> 3; + x = x | 3; + x = x ^ 3; + x = x % 3; + x = x & 3; + + x = x + g(); + x = x - g(); + x = x / g(); + x = x * g(); + x = x >> g(); + x = x << g(); + x = x >>> g(); + x = x | g(); + x = x ^ g(); + x = x % g(); + x = x & g(); + } + expect: { + x += 3; + x -= 3; + x /= 3; + x *= 3; + x >>= 3; + x <<= 3; + x >>>= 3; + x |= 3; + x ^= 3; + x %= 3; + x &= 3; + + x += g(); + x -= g(); + x /= g(); + x *= g(); + x >>= g(); + x <<= g(); + x >>>= g(); + x |= g(); + x ^= g(); + x %= g(); + x &= g(); + } +} + +op_equals_right_global_var: { + options = { + evaluate: true, + } + input: { + x = (x -= 2) ^ x; + + x = 3 + x; + x = 3 - x; + x = 3 / x; + x = 3 * x; + x = 3 >> x; + x = 3 << x; + x = 3 >>> x; + x = 3 | x; + x = 3 ^ x; + x = 3 % x; + x = 3 & x; + + x = g() + x; + x = g() - x; + x = g() / x; + x = g() * x; + x = g() >> x; + x = g() << x; + x = g() >>> x; + x = g() | x; + x = g() ^ x; + x = g() % x; + x = g() & x; + } + expect: { + x = (x -= 2) ^ x; + + x = 3 + x; + x = 3 - x; + x = 3 / x; + x *= 3; + x = 3 >> x; + x = 3 << x; + x = 3 >>> x; + x |= 3; + x ^= 3; + x = 3 % x; + x &= 3; + + x = g() + x; + x = g() - x; + x = g() / x; + x = g() * x; + x = g() >> x; + x = g() << x; + x = g() >>> x; + x = g() | x; + x = g() ^ x; + x = g() % x; + x = g() & x; + } +} |