local w=require(script.Parent.Parent.Parent.Util.BasicallyIdentical)local u=require(script.Parent.Parent.Enum)local T={[u.Blind.Trichromacy]="\084\114\105\099\104\114\111\109\097\099\121";[u.Blind.Protanopia]="\080\114\111\116\097\110\111\112\105\097",[u.Blind.Protanomaly]="\080\114\111\116\097\110\111\109\097\108\121",[u.Blind.Deuteranopia]="\068\101\117\116\101\114\097\110\111\112\105\097";[u.Blind.Deuteranomaly]="\068\101\117\116\101\114\097\110\111\109\097\108\121";[u.Blind.Tritanopia]="\084\114\105\116\097\110\111\112\105\097",[u.Blind.Tritanomaly]="\084\114\105\116\097\110\111\109\097\108\121",[u.Blind.Achromatopsia]="\065\099\104\114\111\109\097\116\111\112\115\105\097",[u.Blind.Achromatomaly]="\065\099\104\114\111\109\097\116\111\109\097\108\121"}return function()local S=require(script.Parent)local Z=Color3.fromHex("\048\048\097\050\102\102")local g={[u.Blind.Trichromacy]=Z;[u.Blind.Protanomaly]=Color3.fromHex("\052\057\057\098\102\097"),[u.Blind.Protanopia]=Color3.fromHex("\055\051\057\055\102\055"),[u.Blind.Deuteranomaly]=Color3.fromHex("\051\052\057\101\102\102"),[u.Blind.Deuteranopia]=Color3.fromHex("\053\050\057\098\102\102");[u.Blind.Tritanomaly]=Color3.fromHex("\048\048\097\056\100\049");[u.Blind.Tritanopia]=Color3.fromHex("\048\048\097\098\098\054"),[u.Blind.Achromatomaly]=Color3.fromHex("\053\053\057\048\098\050"),[u.Blind.Achromatopsia]=Color3.fromHex("\056\054\056\054\056\054")}it("\116\104\114\111\119\115 \119\105\116\104 \105\110\099\111\114\114\101\099\116 \097\114\103\117\109\101\110\116\115",function()(expect(pcall(S,Vector3.one,true))).to.equal(false);(expect(pcall(S,Color3.new(),"\104\101\108\108\111"))).to.equal(false);(expect(pcall(S,Color3.new(),u.Blind.Trichromacy))).to.equal(true)end)it("\114\101\116\117\114\110\115 \097 \067\111\108\111\114\051",function()local T=S(Z,u.Blind.Trichromacy);(expect(w(Z,T))).to.equal(true)end)for u,g in pairs(g)do it("\099\111\114\114\101\099\116\108\121 \115\105\109\117\108\097\116\101\115 "..(T[u]:lower().." \097\103\097\105\110\115\116 \101\120\112\101\099\116\101\100 \111\117\116\112\117\116"),function()local T=S(Z,u);(expect(w(g,T))).to.equal(true)end)end end
local BasicallyIdentical = require(script.Parent.Parent.Parent.Util.BasicallyIdentical)
local Enums = require(script.Parent.Parent.Enum)

local BLIND_NAMES = {
	[Enums.Blind.Trichromacy] = "Trichromacy",
	[Enums.Blind.Protanopia] = "Protanopia",
	[Enums.Blind.Protanomaly] = "Protanomaly",
	[Enums.Blind.Deuteranopia] = "Deuteranopia",
	[Enums.Blind.Deuteranomaly] = "Deuteranomaly",
	[Enums.Blind.Tritanopia] = "Tritanopia",
	[Enums.Blind.Tritanomaly] = "Tritanomaly",
	[Enums.Blind.Achromatopsia] = "Achromatopsia",
	[Enums.Blind.Achromatomaly] = "Achromatomaly",
}

return function()
	local Simulate = require(script.Parent)

	local TEST_COLOR = Color3.fromHex("00a2ff")

	local EXPECT_COLORS = {
		[Enums.Blind.Trichromacy] = TEST_COLOR,
		[Enums.Blind.Protanomaly] = Color3.fromHex("499bfa"),
		[Enums.Blind.Protanopia] = Color3.fromHex("7397f7"),
		[Enums.Blind.Deuteranomaly] = Color3.fromHex("349eff"),
		[Enums.Blind.Deuteranopia] = Color3.fromHex("529bff"),
		[Enums.Blind.Tritanomaly] = Color3.fromHex("00a8d1"),
		[Enums.Blind.Tritanopia] = Color3.fromHex("00abb6"),
		[Enums.Blind.Achromatomaly] = Color3.fromHex("5590b2"),
		[Enums.Blind.Achromatopsia] = Color3.fromHex("868686"),
	}

	it("throws with incorrect arguments", function()
		expect(pcall(Simulate, Vector3.one, true)).to.equal(false)
		expect(pcall(Simulate, Color3.new(), "hello")).to.equal(false)
		expect(pcall(Simulate, Color3.new(), Enums.Blind.Trichromacy)).to.equal(true)
	end)

	it("returns a Color3", function()
		local result = Simulate(TEST_COLOR, Enums.Blind.Trichromacy)
		expect(BasicallyIdentical(TEST_COLOR, result)).to.equal(true)
	end)

	for blinder, expected in pairs(EXPECT_COLORS) do
		it("correctly simulates " .. BLIND_NAMES[blinder]:lower() .. " against expected output", function()
			local result = Simulate(TEST_COLOR, blinder)
			expect(BasicallyIdentical(expected, result)).to.equal(true)
		end)
	end
end
