-- -----------------------------------------------------------------------------
-- SimNetwork
-- simtest.lua
-- Tests the simulation engine
-- -----------------------------------------------------------------------------

if not SimNetwork_DATA		then dofile("data.lua") end
if not SimNetwork_SIMULATION	then dofile("simulation.lua") end


houses = Customer:new(CUSTOMER.resedential.houses, "Houses")
offices = Customer:new(CUSTOMER.business.offices, "Offices")
church = Customer:new(CUSTOMER.resedential.church, "Curch")

cable1 = Cable:new(CABLE.b10)
cable2 = Cable:new(CABLE.b100)

print("Connecting Houses to Offices, Offices to Church")
houses:addConnection(offices, cable1)
offices:addConnection(church, cable2)

-- is 'houses' connected to 'offices'?
local testRes = houses:getLink(offices)
if testRes == nil then
	print("Houses not linked to offices")
else
	print("Houses linked to offices through ", testRes.cableType, " Mbps cable")
end

testRes = church:getLink(offices)
if testRes == nil then
	print("Church not linked to offices!")
else
	print("Church linked to offices through ", testRes.cableType, " Mbps cable")
end

testRes = church:getLink(houses)
if testRes == nil then
	print("Church not linked to houses!")
else
	print("Church linked to houses through ", testRes.cableType, " Mbps cable")
end

print("Test complete!")

