return function()local m=require(script.Parent.sortCounterClockwise)it("\115\104\111\117\108\100 \115\111\114\116 \097 \108\105\115\116 \111\102 \112\111\105\110\116\115 \105\110 \099\111\117\110\116\101\114\099\108\111\099\107\119\105\115\101 \111\114\100\101\114",function()local n={Vector2.new(5,2);Vector2.new(2,3),Vector2.new(8,4),Vector2.new(0,5)}local K=m(n);(expect(K[1])).to.equal(n[4]);(expect(K[2])).to.equal(n[3]);(expect(K[3])).to.equal(n[1]);(expect(K[4])).to.equal(n[2])end)it("\115\104\111\117\108\100 \117\115\101 \116\104\101 \114\105\103\104\116\109\111\115\116 \112\111\105\110\116 \119\104\101\110 \089 \099\111\111\114\100\105\110\097\116\101\115 \097\114\101 \116\105\101\100",function()local n={Vector2.new(2,2);Vector2.new(8,3);Vector2.new(8,5)}local K=m(n);(expect(K[1])).to.equal(n[3])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 n={Vector2.new(0,0),Vector2.new(1,1);Vector2.new(2,2)}local K=m(n);(expect(n)).to.never.equal(K)end)end
return function()
	local sortCounterClockwise = require(script.Parent.sortCounterClockwise)

	it("should sort a list of points in counterclockwise order", function()
		-- https://www.desmos.com/calculator/atvolzmilh
		local points = {
			Vector2.new(5, 2),
			Vector2.new(2, 3),
			Vector2.new(8, 4),

			-- Bigger Y coordinate means a point is further down the screen.
			-- This becomes the anchor.
			Vector2.new(0, 5),
		}

		local sorted = sortCounterClockwise(points)

		expect(sorted[1]).to.equal(points[4])
		expect(sorted[2]).to.equal(points[3])
		expect(sorted[3]).to.equal(points[1])
		expect(sorted[4]).to.equal(points[2])
	end)

	it("should use the rightmost point when Y coordinates are tied", function()
		-- https://www.desmos.com/calculator/2nvr3pow7c
		local points = {
			Vector2.new(2, 2),
			Vector2.new(8, 3),
			-- The anchor point is the lowest point that is furthest to the
			-- right, so this point should become the anchor.
			Vector2.new(8, 5),
		}

		local sorted = sortCounterClockwise(points)

		expect(sorted[1]).to.equal(points[3])
	end)

	it("should return a new table", function()
		local points = {
			Vector2.new(0, 0),
			Vector2.new(1, 1),
			Vector2.new(2, 2),
		}

		local sorted = sortCounterClockwise(points)

		expect(points).to.never.equal(sorted)
	end)
end
