require("test/setup")

local Statistics = require("statistics")

function testReportGameOver()
    ---@type Statistics
    local stats = Statistics.new()
    stats.innings[1].home.score = 0
    stats.innings[1].away.score = 0
    luaunit.assertIsFalse(stats:gameIsOver(9, 9, "home"), "Tie games should not report a game over")

    stats.innings[1].home.score = 1
    luaunit.assertIsTrue(stats:gameIsOver(9, 9, "home"), "Team in lead should report a game over")

    stats.innings[1].home.score = 1
    luaunit.assertIsFalse(stats:gameIsOver(1, 9, "home"), "Should not game over with innings left")
end

os.exit(luaunit.LuaUnit.run())
