return function()local C=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local q=C.Packages local t=require(q.Llama)local O=t.Dictionary local G=O.filter it("\115\104\111\117\108\100 \118\097\108\105\100\097\116\101 \116\121\112\101\115",function()local C={{0};{{},0};{0,function() end}}for q=1,#C,1 do local t,O=pcall(function()G(unpack(C[q]))end);(expect(string.find(O,"\101\120\112\101\099\116\101\100\044 \103\111\116"))).to.be.ok()end end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \110\101\119 \116\097\098\108\101",function()local C={};(expect(G(C,function() end))).never.to.equal(C)end)it("\115\104\111\117\108\100 \110\111\116 \109\117\116\097\116\101 \112\097\115\115\101\100 \105\110 \116\097\098\108\101\115",function()local C={foo=1;bar=2;baz=3}local q=0 setmetatable(C,{__newindex=function()q=q+1 end})local function t()return true end G(C,t);(expect(q)).to.equal(0)end)it("\115\104\111\117\108\100 \099\097\108\108 \116\104\101 \099\097\108\108\098\097\099\107 \102\111\114 \101\097\099\104 \101\108\101\109\101\110\116",function()local C={foo=1;bar=2;baz=3}local q={}local function t(C,t)q[t]=C return true end G(C,t)for C,t in pairs(C)do(expect(q[C])).to.equal(t)end for q,t in pairs(q)do(expect(t)).to.equal(C[q])end end)it("\115\104\111\117\108\100 \099\111\114\114\101\099\116\108\121 \117\115\101 \116\104\101 \102\105\108\116\101\114 \099\097\108\108\098\097\099\107",function()local C={one=1,two=2;three=3;four=4,five=5}local function q(C)return C%2==0 end local t=G(C,q);(expect(t.one)).never.to.be.ok();(expect(t.two)).to.equal(2);(expect(t.three)).never.to.be.ok();(expect(t.four)).to.equal(4);(expect(t.five)).never.to.be.ok()end)it("\115\104\111\117\108\100 \099\111\112\121 \116\104\101 \116\097\098\108\101 \099\111\114\114\101\099\116\108\121",function()local C={foo=1,bar=2;baz=3}local function q()return true end local t=G(C,q)for C,q in pairs(C)do(expect(t[C])).to.equal(q)end for q,t in pairs(t)do(expect(t)).to.equal(C[q])end end)it("\115\104\111\117\108\100 \119\111\114\107 \119\105\116\104 \097\110 \101\109\112\116\121 \116\097\098\108\101",function()local C=false local function q()C=true return true end local t=G({},q);(expect(next(t))).never.to.be.ok();(expect(C)).to.equal(false)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \097\108\108 \101\108\101\109\101\110\116\115 \102\114\111\109 \103\105\118\101\110 \116\097\098\108\101 \119\104\101\110 \099\097\108\108\098\097\099\107 \114\101\116\117\114\110 \097\108\119\097\121\115 \102\097\108\115\101",function()local C={foo=1;bar=2;baz=3}local function q()return false end local t=G(C,q);(expect(next(t))).never.to.be.ok()end)end
return function()
	local ReplicatedStorage = game:GetService("ReplicatedStorage")

	local Packages = ReplicatedStorage.Packages
	local Llama = require(Packages.Llama)

	local Dictionary = Llama.Dictionary
	local filter = Dictionary.filter

	it("should validate types", function()
		local args = {
			{ 0 },
			{ {}, 0 },
			{ 0, function() end }
		}

		for i = 1, #args do
			local _, err = pcall(function()
				filter(unpack(args[i]))
			end)

			expect(string.find(err, "expected, got")).to.be.ok()
		end
	end)

	it("should return a new table", function()
		local a = {}

		expect(filter(a, function() end)).never.to.equal(a)
	end)

	it("should not mutate passed in tables", function()
		local a = {
			foo = 1,
			bar = 2,
			baz = 3,
		}
		local mutations = 0

		setmetatable(a, {
			__newindex = function()
				mutations = mutations + 1
			end,
		})

		local function alwaysTrue()
			return true
		end

		filter(a, alwaysTrue)

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

	it("should call the callback for each element", function()
		local a = {
			foo = 1,
			bar = 2,
			baz = 3
		}
		local copy = {}

		local function copyCallback(v, i)
			copy[i] = v
			return true
		end

		filter(a, copyCallback)

		for k, v in pairs(a) do
			expect(copy[k]).to.equal(v)
		end

		for k, v in pairs(copy) do
			expect(v).to.equal(a[k])
		end
	end)

	it("should correctly use the filter callback", function()
		local a = {
			one = 1, 
			two = 2, 
			three = 3, 
			four = 4, 
			five = 5,
		}

		local function evenOnly(v)
			return v % 2 == 0
		end

		local b = filter(a, evenOnly)

		expect(b.one).never.to.be.ok()
		expect(b.two).to.equal(2)
		expect(b.three).never.to.be.ok()
		expect(b.four).to.equal(4)
		expect(b.five).never.to.be.ok()
	end)

	it("should copy the table correctly", function()
		local a = {
			foo = 1, 
			bar = 2, 
			baz = 3,
		}

		local function keepAll()
			return true
		end

		local b = filter(a, keepAll)

		for k, v in pairs(a) do
			expect(b[k]).to.equal(v)
		end

		for k, v in pairs(b) do
			expect(v).to.equal(a[k])
		end
	end)

	it("should work with an empty table", function()
		local called = false

		local function callback()
			called = true
			return true
		end

		local a = filter({}, callback)

		expect(next(a)).never.to.be.ok()
		expect(called).to.equal(false)
	end)

	it("should remove all elements from given table when callback return always false", function()
		local a = {
			foo = 1, 
			bar = 2, 
			baz = 3,
		}

		local function removeAll()
			return false
		end

		local b = filter(a, removeAll)

		expect(next(b)).never.to.be.ok()
	end)
end