return function()local v=require(script.Parent.reduceRight)it("\115\104\111\117\108\100 \114\101\100\117\099\101 \116\104\101 \103\105\118\101\110 \097\114\114\097\121 \102\114\111\109 \116\104\101 \114\105\103\104\116",function()local b={1;2;3}local G=v(b,function(v,b)return v+b end,0);(expect(G)).to.equal(6)end)it("\115\104\111\117\108\100 \114\101\100\117\099\101 \116\104\101 \103\105\118\101\110 \097\114\114\097\121 \102\114\111\109 \116\104\101 \114\105\103\104\116\044 \117\115\105\110\103 \116\104\101 \108\097\115\116 \101\108\101\109\101\110\116 \097\115 \116\104\101 \105\110\105\116\105\097\108 \118\097\108\117\101",function()local b={1;2,3}local G=v(b,function(v,b)return v-b end);(expect(G)).to.equal(0)end)it("\115\104\111\117\108\100 \114\101\100\117\099\101 \116\104\101 \097\114\114\097\121 \102\114\111\109 \116\104\101 \114\105\103\104\116\044 \101\118\101\110 \105\102 \116\104\101 \097\114\114\097\121 \104\097\115 \097 \102\097\108\115\121 \105\110\105\116\105\097\108 \118\097\108\117\101",function()local b={true;false;true}local G=v(b,function(v,b)return v or b end,false);(expect(G)).to.equal(true)end)end
return function()
	local ReduceRight = require(script.Parent.reduceRight)

	it("should reduce the given array from the right", function()
		local array = { 1, 2, 3 }

		local reduced = ReduceRight(array, function(accumulator, value)
			return accumulator + value
		end, 0)

		expect(reduced).to.equal(6)
	end)

	it(
		"should reduce the given array from the right, using the last element as the initial value",
		function()
			local array = { 1, 2, 3 }

			local reduced = ReduceRight(array, function(accumulator, value)
				return accumulator - value
			end)

			expect(reduced).to.equal(0)
		end
	)

	it(
		"should reduce the array from the right, even if the array has a falsy initial value",
		function()
			local array = { true, false, true }

			local reduced = ReduceRight(array, function(accumulator, value)
				return accumulator or value
			end, false)

			expect(reduced).to.equal(true)
		end
	)
end
