return describe("operators", function() it("should support addition", function() return assert.same(1 + 2, 3) end) it("should support subtraction", function() return assert.same(5 - 3, 2) end) it("should support multiplication", function() return assert.same(4 * 3, 12) end) it("should support division", function() return assert.same(10 / 2, 5) end) it("should support modulo", function() return assert.same(10 % 3, 1) end) it("should support exponentiation", function() return assert.same(2 ^ 3, 8) end) it("should support unary minus", function() return assert.same(-5, -5) end) it("should support equality comparison", function() assert.is_true(1 == 1) return assert.is_false(1 == 2) end) it("should support inequality comparison", function() assert.is_true(1 ~= 2) return assert.is_false(1 ~= 1) end) it("should support less than", function() assert.is_true(1 < 2) return assert.is_false(2 < 1) end) it("should support greater than", function() assert.is_true(2 > 1) return assert.is_false(1 > 2) end) it("should support less than or equal", function() assert.is_true(1 <= 2) assert.is_true(2 <= 2) return assert.is_false(3 <= 2) end) it("should support greater than or equal", function() assert.is_true(2 >= 1) assert.is_true(2 >= 2) return assert.is_false(1 >= 2) end) it("should support logical and", function() assert.same(true and false, false) assert.same(true and true, true) return assert.same(false and true, false) end) it("should support logical or", function() assert.same(true or false, true) assert.same(false or true, true) return assert.same(false or false, false) end) it("should support logical not", function() assert.same(not true, false) assert.same(not false, true) return assert.same(not nil, true) end) it("should support bitwise and", function() return assert.same(5 & 3, 1) end) it("should support bitwise or", function() return assert.same(5 | 3, 7) end) it("should support bitwise xor", function() return assert.same(5 ~ 3, 6) end) it("should support left shift", function() return assert.same(2 << 3, 16) end) it("should support right shift", function() return assert.same(16 >> 2, 4) end) it("should support string concatenation", function() return assert.same("hello" .. " world", "hello world") end) it("should support length operator", function() assert.same(#"hello", 5) return assert.same(#{ 1, 2, 3 }, 3) end) it("should respect operator precedence", function() assert.same(1 + 2 * 3, 7) return assert.same((1 + 2) * 3, 9) end) it("should support compound assignment", function() local x = 10 x = x + 5 return assert.same(x, 15) end) it("should support compound subtraction", function() local x = 10 x = x - 3 return assert.same(x, 7) end) it("should support compound multiplication", function() local x = 5 x = x * 2 return assert.same(x, 10) end) it("should support compound division", function() local x = 20 x = x / 4 return assert.same(x, 5) end) it("should handle division by zero", function() local result = pcall(function() local x = 10 / 0 end) return assert.is_true(result) end) it("should handle very large numbers", function() local big = 1e100 return assert.is_true(big > 0) end) it("should handle very small numbers", function() local small = 1e-100 return assert.is_true(small > 0) end) it("should support negation", function() assert.same(-10, -10) return assert.same end) it("should work with complex expressions", function() local result = (1 + 2) * (3 + 4) / 2 return assert.same(result, 10.5) end) it("should support power with decimal", function() return assert.same(4 ^ 0.5, 2) end) return it("should handle modulo with negative numbers", function() return assert.same(-10 % 3, 2) end) end)