local o=require("\078\101\120\117\115\085\110\105\116\084\101\115\116\105\110\103")local T=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local m=require((T:WaitForChild("\080\114\111\106\101\099\116")):WaitForChild("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101"))local w=m:GetResource("\083\116\097\116\101\046\068\117\110\103\101\111\110\065\108\108\111\099\097\116\105\111\110")local e=o.UnitTest:Extend()function e.Setup(o)o.CuT=w.new()end o:RegisterUnitTest((e.new("\084\101\115\116\065\108\108\111\099\097\116\101")):SetRun(function(o)o:AssertEquals({o.CuT:Allocate(5,5)},{1;"\053\095\053\095\049"},"\065\108\108\111\099\097\116\105\111\110 \105\115 \105\110\099\111\114\114\101\099\116\046")o:AssertEquals({o.CuT:Allocate(5,5)},{2;"\053\095\053\095\050"},"\065\108\108\111\099\097\116\105\111\110 \105\115 \105\110\099\111\114\114\101\099\116\046")o:AssertEquals({o.CuT:Allocate(4,4)},{3,"\052\095\052\095\051"},"\065\108\108\111\099\097\116\105\111\110 \105\115 \105\110\099\111\114\114\101\099\116\046")o:AssertEquals({o.CuT:Allocate(6,5)},{3;"\054\095\053\095\051"},"\065\108\108\111\099\097\116\105\111\110 \105\115 \105\110\099\111\114\114\101\099\116\046")o:AssertEquals({o.CuT:Allocate(5,5)},{4,"\053\095\053\095\052"},"\065\108\108\111\099\097\116\105\111\110 \105\115 \105\110\099\111\114\114\101\099\116\046")o.CuT:Deallocate("\053\095\053\095\050")o:AssertEquals({o.CuT:Allocate(5,5)},{2,"\053\095\053\095\050"},"\065\108\108\111\099\097\116\105\111\110 \105\115 \105\110\099\111\114\114\101\099\116\046")o.CuT:Deallocate("\054\095\053\095\051")o:AssertEquals({o.CuT:Allocate(5,5)},{5;"\053\095\053\095\053"},"\065\108\108\111\099\097\116\105\111\110 \105\115 \105\110\099\111\114\114\101\099\116\046")o.CuT:Deallocate("\052\095\052\095\051")o:AssertEquals({o.CuT:Allocate(5,5)},{3;"\053\095\053\095\051"},"\065\108\108\111\099\097\116\105\111\110 \105\115 \105\110\099\111\114\114\101\099\116\046")end))return true
--[[
TheNexusAvenger

Tests the DungeonAllocation class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ReplicatedStorageProject = require(ReplicatedStorage:WaitForChild("Project"):WaitForChild("ReplicatedStorage"))
local DungeonAllocation = ReplicatedStorageProject:GetResource("State.DungeonAllocation")



--[[
Setups up the test.
--]]
local DungeonAllocationTest = NexusUnitTesting.UnitTest:Extend()
function DungeonAllocationTest:Setup()
    --Create the component under testing.
    self.CuT = DungeonAllocation.new()
end

--[[
Tests allocating and deallocating.
--]]
NexusUnitTesting:RegisterUnitTest(DungeonAllocationTest.new("TestAllocate"):SetRun(function(self)
    self:AssertEquals({self.CuT:Allocate(5,5)},{1,"5_5_1"},"Allocation is incorrect.")
    self:AssertEquals({self.CuT:Allocate(5,5)},{2,"5_5_2"},"Allocation is incorrect.")
    self:AssertEquals({self.CuT:Allocate(4,4)},{3,"4_4_3"},"Allocation is incorrect.")
    self:AssertEquals({self.CuT:Allocate(6,5)},{3,"6_5_3"},"Allocation is incorrect.")
    self:AssertEquals({self.CuT:Allocate(5,5)},{4,"5_5_4"},"Allocation is incorrect.")
    self.CuT:Deallocate("5_5_2")
    self:AssertEquals({self.CuT:Allocate(5,5)},{2,"5_5_2"},"Allocation is incorrect.")
    self.CuT:Deallocate("6_5_3")
    self:AssertEquals({self.CuT:Allocate(5,5)},{5,"5_5_5"},"Allocation is incorrect.")
    self.CuT:Deallocate("4_4_3")
    self:AssertEquals({self.CuT:Allocate(5,5)},{3,"5_5_3"},"Allocation is incorrect.")
end))



return true