return function()local n=require(script.Parent)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \049\048",function()(expect(n("\049\048"))).to.equal(10)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 -\049\048",function()(expect(n("-\049\048"))).to.equal(-10)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \043\049\048",function()(expect(n("\043\049\048"))).to.equal(10)end)it("\115\104\111\117\108\100 \097\100\100 \049 \116\111 \050",function()(expect(n("\049 \043 \050"))).to.equal(3)end)it("\115\104\111\117\108\100 \115\117\098\116\114\097\099\116 \049 \102\114\111\109 \051",function()(expect(n("\051 - \049"))).to.equal(2)end)it("\115\104\111\117\108\100 \109\117\108\116\105\112\108\121 \050 \098\121 \051",function()(expect(n("\050 \042 \051"))).to.equal(6)end)it("\115\104\111\117\108\100 \100\105\118\105\100\101 \057 \098\121 \050",function()(expect(n("\057 \047 \050"))).to.equal(4.5)end)it("\115\104\111\117\108\100 \116\097\107\101 \051 \116\111 \116\104\101 \112\111\119\101\114 \111\102 \050",function()(expect(n("\051 \094 \050"))).to.equal(9.0)end)it("\115\104\111\117\108\100 \116\097\107\101 \053 \109\111\100\117\108\111 \050",function()(expect(n("\053 \037 \050"))).to.equal(1)end)it("\115\104\111\117\108\100 \101\118\097\108\117\097\116\101 \105\110\110\101\114 \101\120\112\114\101\115\115\105\111\110",function()(expect(n("\040\040\040\040\040\053 \043 \052 \042 \050\041\041\041\041\041"))).to.equal(13)end)it("\115\104\111\117\108\100 \101\118\097\108\117\097\116\101 \102\117\110\099\116\105\111\110",function()(expect(n("\097\098\115\040-\052\041"))).to.equal(4)end)it("\115\104\111\117\108\100 \101\118\097\108\117\097\116\101 \102\117\110\099\116\105\111\110 \119\105\116\104 \109\117\108\116\105\112\108\101 \097\114\103\117\109\101\110\116\115",function()(expect(n("\109\105\110\040\050\044 \052\044 \049\044 \053\044 \051\044 \049\048\041"))).to.equal(math.min(2,4,1,5,3,10))end)it("\115\104\111\117\108\100 \115\111\108\118\101 \099\111\109\112\111\115\105\116\101 \102\117\110\099\116\105\111\110\115",function()(expect(n("\112\111\119\040\052\044 \109\097\120\040\053\044 \099\108\097\109\112\040\049\048\044 \049\044 \051\041\041\041"))).to.equal(math.pow(4,math.max(5,math.clamp(10,1,3))))end)it("\115\104\111\117\108\100 \101\118\097\108\117\097\116\101 \099\111\110\115\116\097\110\116",function()(expect(n("\112\105"))).to.equal(math.pi)end)it("\115\104\111\117\108\100 \101\118\097\108\117\097\116\101 \118\097\114\105\097\098\108\101",function()(expect(n("\102\111\111",{foo=5}))).to.equal(5)end)it("\115\104\111\117\108\100 \117\115\101 \118\097\114\105\097\098\108\101 \105\110\115\116\101\097\100 \111\102 \099\111\110\115\116\097\110\116",function()(expect(n("\112\105",{pi=6}))).to.equal(6)end)it("\115\104\111\117\108\100 \101\118\097\108\117\097\116\101 \099\111\114\114\101\099\116\108\121",function()(expect(n("\053 \043 \040\040\049 \043 \050\041 \042 \052\041 - \051"))).to.equal(14);(expect(n("\051 \043 \052 \042 \050 \047 \040 \049 - \053 \041 \094 \050 \094 \051"))).to.equal(3.0001220703125);(expect(n("\049\048 \043 \052 \094 \051 \042 \050 \037 \052 \047 \040 \049 - \053 \041 \094 \050 \094 \051"))).to.equal(10.0);(expect(n("\052 \043 \052\046\053 \094 \051 \042 \050 \094 \050\046\050 \094 \051"))).to.equal(146223.37901723);(expect(n("\115\113\114\116\040\052\041 \043 \051"))).to.equal(math.sqrt(4)+3);(expect(n("\049\043\115\113\114\116\040\052\041"))).to.equal(1+math.sqrt(4));(expect(n("\115\105\110\040\048\046\053\041 \043 \115\113\114\116\040\052 \043 \053 \042 \051\041"))).to.equal(math.sin(.5)+math.sqrt(19));(expect(n("\115\105\110\040\048\046\053\041 \043 \118\097\114",{var=2.35}))).to.equal(math.sin(.5)+2.35);(expect(n("\118\097\114\049\042\118\097\114\050",{var1=3,var2=5}))).to.equal(15);(expect(n("\040\051 \042 \040\102\111\111\043\050\041\041 \047 \050",{foo=3}))).to.equal(7.5)end)it("\115\104\111\117\108\100 \116\104\114\111\119 \119\104\101\110 \105\110\112\117\116 \105\115 \101\109\112\116\121",function()(expect(function()n("")end)).to.throw("\073\110\112\117\116 \101\109\112\116\121")end)it("\115\104\111\117\108\100 \116\104\114\111\119 \119\104\101\110 \117\110\097\114\121 \104\097\115 \110\111 \118\097\108\117\101",function()(expect(function()n("-")end)).to.throw("\069\120\112\101\099\116\101\100 \118\097\108\117\101 \097\102\116\101\114 \117\110\097\114\121")end)it("\115\104\111\117\108\100 \116\104\114\111\119 \119\104\101\110 \112\097\114\101\110\116\104\101\115\101\115 \097\114\101 \101\109\112\116\121",function()(expect(function()n("\040\041")end)).to.throw("\069\120\112\101\099\116\101\100 \118\097\108\117\101 \119\105\116\104\105\110 \112\097\114\101\110\116\104\101\115\101\115")end)it("\115\104\111\117\108\100 \116\104\114\111\119 \119\104\101\110 \098\105\110\097\114\121 \111\112\101\114\097\116\105\111\110 \104\097\115 \110\111 \114\105\103\104\116 \104\097\110\100 \115\105\100\101",function()(expect(function()n("\049 \043 ")end)).to.throw("\069\120\112\101\099\116\101\100 \118\097\108\117\101 \097\102\116\101\114 \043")end)it("\115\104\111\117\108\100 \116\104\114\111\119 \119\104\101\110 \118\097\114\105\097\098\108\101 \100\111\101\115 \110\111\116 \101\120\105\115\116",function()(expect(function()n("\102\111\111")end)).to.throw("\'\102\111\111\' \105\115 \110\111\116 \100\101\102\105\110\101\100")end)it("\115\104\111\117\108\100 \116\104\114\111\119 \119\104\101\110 \102\117\110\099\116\105\111\110 \100\111\101\115 \110\111\116 \101\120\105\115\116",function()(expect(function()n("\102\111\111\040\041")end)).to.throw("\'\102\111\111\' \105\115 \110\111\116 \100\101\102\105\110\101\100")end)it("\115\104\111\117\108\100 \116\104\114\111\119 \119\104\101\110 \116\104\101\114\101 \105\115 \110\111 \099\108\111\115\105\110\103 \112\097\114\101\110\116\104\101\115\105\115",function()(expect(function()n("\040\053")end)).to.throw("\069\120\112\101\099\116\101\100 \067\108\111\115\101 \080\097\114\101\110\116\104\101\115\105\115")end)it("\115\104\111\117\108\100 \116\104\114\111\119 \119\104\101\110 \102\117\110\099\116\105\111\110 \104\097\115 \110\111 \099\108\111\115\101 \112\097\114\101\110\116\104\101\115\105\115",function()(expect(function()n("\114\097\100\040\053")end)).to.throw("\069\120\112\101\099\116\101\100 \067\108\111\115\101 \080\097\114\101\110\116\104\101\115\105\115")end)it("\115\104\111\117\108\100 \116\104\114\111\119 \119\104\101\110 \105\116 \101\110\099\111\117\110\116\101\114\115 \097\110 \117\110\107\110\111\119\110 \115\101\113\117\101\110\099\101",function()(expect(function()n("\049\043\050\038")end)).to.throw("\085\110\101\120\112\101\099\116\101\100 \115\101\113\117\101\110\099\101\058 \038")end)end
return function()
	local evaluate = require(script.Parent)

	it("should return 10", function()
		expect(evaluate("10")).to.equal(10)
	end)

	it("should return -10", function()
		expect(evaluate("-10")).to.equal(-10)
	end)

	it("should return +10", function()
		expect(evaluate("+10")).to.equal(10)
	end)

	it("should add 1 to 2", function()
		expect(evaluate("1 + 2")).to.equal(1 + 2)
	end)

	it("should subtract 1 from 3", function()
		expect(evaluate("3 - 1")).to.equal(3 - 1)
	end)

	it("should multiply 2 by 3", function()
		expect(evaluate("2 * 3")).to.equal(2 * 3)
	end)

	it("should divide 9 by 2", function()
		expect(evaluate("9 / 2")).to.equal(9 / 2)
	end)

	it("should take 3 to the power of 2", function()
		expect(evaluate("3 ^ 2")).to.equal(3 ^ 2)
	end)

	it("should take 5 modulo 2", function()
		expect(evaluate("5 % 2")).to.equal(5 % 2)
	end)

	it("should evaluate inner expression", function()
		expect(evaluate("(((((5 + 4 * 2)))))")).to.equal(5 + 4 * 2)
	end)

	it("should evaluate function", function()
		expect(evaluate("abs(-4)")).to.equal(4)
	end)

	it("should evaluate function with multiple arguments", function()
		expect(evaluate("min(2, 4, 1, 5, 3, 10)")).to.equal(math.min(2, 4, 1, 5, 3, 10))
	end)

	it("should solve composite functions", function()
		expect(evaluate("pow(4, max(5, clamp(10, 1, 3)))")).to.equal(math.pow(4, math.max(5, math.clamp(10, 1, 3))))
	end)

	it("should evaluate constant", function()
		expect(evaluate("pi")).to.equal(math.pi)
	end)

	it("should evaluate variable", function()
		expect(evaluate("foo", { foo = 5 })).to.equal(5)
	end)

	it("should use variable instead of constant", function()
		expect(evaluate("pi", { pi = 6 })).to.equal(6)
	end)

	it("should evaluate correctly", function()
		expect(evaluate("5 + ((1 + 2) * 4) - 3")).to.equal(5 + ((1 + 2) * 4) - 3)
		expect(evaluate("3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3")).to.equal(3 + 4 * 2 / (1 - 5) ^ 2 ^ 3)
		expect(evaluate("10 + 4 ^ 3 * 2 % 4 / ( 1 - 5 ) ^ 2 ^ 3")).to.equal(10 + 4 ^ 3 * 2 % 4 / (1 - 5) ^ 2 ^ 3)
		expect(evaluate("4 + 4.5 ^ 3 * 2 ^ 2.2 ^ 3")).to.equal(4 + 4.5 ^ 3 * 2 ^ 2.2 ^ 3)
		expect(evaluate("sqrt(4) + 3")).to.equal(math.sqrt(4) + 3)
		expect(evaluate("1+sqrt(4)")).to.equal(1 + math.sqrt(4))
		expect(evaluate("sin(0.5) + sqrt(4 + 5 * 3)")).to.equal(math.sin(0.5) + math.sqrt(4 + 5 * 3))
		expect(evaluate("sin(0.5) + var", { var = 2.35 })).to.equal(math.sin(0.5) + 2.35)
		expect(evaluate("var1*var2", { var1 = 3, var2 = 5 })).to.equal(3 * 5)
		expect(evaluate("(3 * (foo+2)) / 2", { foo = 3 })).to.equal((3 * (3 + 2)) / 2)
	end)

	it("should throw when input is empty", function()
		expect(function()
			evaluate("")
		end).to.throw("Input empty")
	end)

	it("should throw when unary has no value", function()
		expect(function()
			evaluate("-")
		end).to.throw("Expected value after unary")
	end)

	it("should throw when parentheses are empty", function()
		expect(function()
			evaluate("()")
		end).to.throw("Expected value within parentheses")
	end)

	it("should throw when binary operation has no right hand side", function()
		expect(function()
			evaluate("1 + ")
		end).to.throw("Expected value after +")
	end)

	it("should throw when variable does not exist", function()
		expect(function()
			evaluate("foo")
		end).to.throw("'foo' is not defined")
	end)

	it("should throw when function does not exist", function()
		expect(function()
			evaluate("foo()")
		end).to.throw("'foo' is not defined")
	end)

	it("should throw when there is no closing parenthesis", function()
		expect(function()
			evaluate("(5")
		end).to.throw("Expected Close Parenthesis")
	end)

	it("should throw when function has no close parenthesis", function()
		expect(function()
			evaluate("rad(5")
		end).to.throw("Expected Close Parenthesis")
	end)

	it("should throw when it encounters an unknown sequence", function()
		expect(function()
			evaluate("1+2&")
		end).to.throw("Unexpected sequence: &")
	end)
end
