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("\071\097\109\101\068\097\116\097\046\071\101\110\101\114\097\116\105\111\110\046\077\097\112\067\101\108\108\115")local e=o.UnitTest:Extend()o:RegisterUnitTest((e.new("\084\101\115\116\073\110\118\097\108\105\100\067\101\108\108\115")):SetRun(function(o)local T=""for o=1,200,1 do for m=1,200,1 do local e=w[o][m]if e~=0 and(e~=1 and(e~=2 and(e~=3 and(e~=4 and(e~=5 and(e~=6 and e~=7))))))then T=T..("\n"..(tostring(o)..("\044"..tostring(m))))end end end if T~=""then o:Fail("\084\104\101 \102\111\108\108\111\119\105\110\103 \099\101\108\108\115 \104\097\118\101 \097\110 \105\110\118\097\108\105\100 \105\100\058"..T)end end))o:RegisterUnitTest((e.new("\084\101\115\116\072\111\117\115\101\115")):SetRun(function(o)local T=""for o=2,199,1 do for m=2,199,1 do if w[o][m]==7 then if w[o-1][m]~=6 and(w[o+1][m]~=6 and(w[o][m-1]~=6 and w[o][m+1]~=6))then T=T..("\n"..(tostring(o)..("\044"..tostring(m))))end end end end if T~=""then o:Fail("\084\104\101 \102\111\108\108\111\119\105\110\103 \104\111\117\115\101 \099\101\108\108\115 \097\114\101 \100\105\115\099\111\110\110\101\099\116\101\100\058"..T)end end))return true
--[[
TheNexusAvenger

Tests the MapCells being valid.
--]]

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

local ReplicatedStorageProject = require(ReplicatedStorage:WaitForChild("Project"):WaitForChild("ReplicatedStorage"))
local MapCells = ReplicatedStorageProject:GetResource("GameData.Generation.MapCells")

local MapCellsTest = NexusUnitTesting.UnitTest:Extend()



--[[
Tests for invalid cells.
--]]
NexusUnitTesting:RegisterUnitTest(MapCellsTest.new("TestInvalidCells"):SetRun(function(self)
    --Get the invalid cells.
    local InvalidCells = ""
    for X = 1,200 do
        for Y = 1,200 do
            local Id = MapCells[X][Y]
            if Id ~= 0 and Id ~= 1 and Id ~= 2 and Id ~= 3 and Id ~= 4 and Id ~= 5 and Id ~= 6 and Id ~= 7 then
                InvalidCells = InvalidCells.."\n"..tostring(X)..","..tostring(Y)
            end
        end
    end

    --Fail the test if invalid houses exist.
    if InvalidCells ~= "" then
        self:Fail("The following cells have an invalid id:"..InvalidCells)
    end
end))

--[[
Tests the houses being valid (connected
to 1 road).
--]]
NexusUnitTesting:RegisterUnitTest(MapCellsTest.new("TestHouses"):SetRun(function(self)
    --Get the invalid cells.
    local InvalidCells = ""
    for X = 2,199 do
        for Y = 2,199 do
            if MapCells[X][Y] == 7 then
                if MapCells[X - 1][Y] ~= 6 and MapCells[X + 1][Y] ~= 6 and MapCells[X][Y - 1]~= 6 and MapCells[X][Y + 1] ~= 6 then
                    InvalidCells = InvalidCells.."\n"..tostring(X)..","..tostring(Y)
                end
            end
        end
    end

    --Fail the test if invalid houses exist.
    if InvalidCells ~= "" then
        self:Fail("The following house cells are disconnected:"..InvalidCells)
    end
end))



return true