local C=script.Parent.Parent local c=C.Parent.Parent.Parent local n=c.Parent local S=require(n.Dev.JestGlobals)local U=S.expect local O=S.describe local w=S.it local p=require(C.math)O("\109\097\116\104 \116\101\115\116\115",function()local C={5;6,7;8,9;10;12,13,13;13;15,15;16;16,18,22}w("\115\104\111\117\108\100 \099\097\108\099\117\108\097\116\101 \116\104\101 \109\101\097\110 \111\102 \097 \108\105\115\116 \111\102 \118\097\108\117\101\115",function()(U(p.getMean(C))).toBe(12.375)end)w("\115\104\111\117\108\100 \099\097\108\099\117\108\097\116\101 \116\104\101 \109\101\100\105\097\110 \111\102 \097 \108\105\115\116 \111\102 \118\097\108\117\101\115",function()(U(p.getMedian(C))).toBe(13)end)w("\115\104\111\117\108\100 \102\105\110\100 \116\104\101 \109\101\100\105\097\110 \111\102 \097 \115\105\110\103\108\101 \118\097\108\117\101 \108\105\115\116",function()(U(p.getMedian({1}))).toBe(1)end)w("\115\104\111\117\108\100 \102\105\110\100 \116\104\101 \115\116\097\110\100\097\114\100 \100\101\118\105\097\116\105\111\110 \111\102 \097 \108\105\115\116 \111\102 \115\097\109\112\108\101\115",function()local c=tonumber(string.format("\037\046\049\050\102",p.getStdDev(C)));(U(c)).toBe(4.512136411945)end)end)
local testWorkspace = script.Parent.Parent
local srcWorkspace = testWorkspace.Parent.Parent.Parent
local rootWorkspace = srcWorkspace.Parent

local JestGlobals = require(rootWorkspace.Dev.JestGlobals)
local jestExpect = JestGlobals.expect
local describe = JestGlobals.describe
local it = JestGlobals.it

local Math = require(testWorkspace.math)

describe("math tests", function()
	local dataset = { 5, 6, 7, 8, 9, 10, 12, 13, 13, 13, 15, 15, 16, 16, 18, 22 }

	it("should calculate the mean of a list of values", function()
		jestExpect(Math.getMean(dataset)).toBe(12.375)
	end)

	it("should calculate the median of a list of values", function()
		jestExpect(Math.getMedian(dataset)).toBe(13)
	end)

	it("should find the median of a single value list", function()
		jestExpect(Math.getMedian({ 1 })).toBe(1)
	end)

	it("should find the standard deviation of a list of samples", function()
		local stdDev = tonumber(string.format("%.12f", Math.getStdDev(dataset)))
		jestExpect(stdDev).toBe(4.512136411945)
	end)
end)
