Skip to content

Commit

Permalink
TerraME#204. Adding test into a separate directory in order to avoid …
Browse files Browse the repository at this point in the history
…problems with sessionInfo().graphics.
  • Loading branch information
pedro-andrade-inpe committed Feb 2, 2018
1 parent 0ba1f8b commit 87ad3bf
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/abc/GoodnessOfFit.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

return{
multiLevel = function(unitTest)
local cs = CellularSpace{
file = filePath("costanza.pgm", "calibration")}
local cs2 = CellularSpace{
file = filePath("costanza2.pgm", "calibration"),
attrname = "costanza"}

-- Discrete Tests:
local result, data = multiLevel{
target = {cs, cs2},
select = "costanza",
discrete = true
}

unitTest:assertEquals(result, 0.865, 0.01) -- 0.84 is the Total Fitness in Costanza Paper Example.

local chart = _Gtme.Chart{
target = data,
select = "fit"
}

unitTest:assertSnapshot(chart, "costanza-original.png")

result, data = multiLevel{
target = {cs, cs2},
select = "costanza",
log = true,
discrete = true
}

unitTest:assertEquals(result, 0.85, 0.01)

chart = _Gtme.Chart{
target = data,
select = "fit",
xLabel = "Window Size",
yLabel = "Fit"
}

unitTest:assertSnapshot(chart, "costanza-log.png")
end
}

0 comments on commit 87ad3bf

Please sign in to comment.