local G=require("\109\111\115\101\115")local z=require("\105\110\118\111\107\097\116\105\111\110\046\100\111\116\097\050\046\116\097\108\101\110\116\115")local f=require("\105\110\118\111\107\097\116\105\111\110\046\099\111\109\098\111\115\046\066\097\115\101\067\111\109\098\111")local u={id=13,specialty="\113\119",stance="\100\101\102\101\110\115\105\118\101";heroLevel=25,damageRating=5,difficultyRating=5,gold=1234;tags={"\108\097\116\101-\103\097\109\101"};items={"\105\116\101\109\095\098\108\105\110\107"};orbs={7,7,7};talents=z.Select(z.L10_LEFT,z.L15_RIGHT,z.L20_RIGHT,z.L25_RIGHT)}describe("\066\097\115\101\067\111\109\098\111",function()local z before_each(function()z=f(u)end)describe("\099\111\110\115\116\114\117\099\116\111\114",function()it("\105\110\105\116\105\097\108\105\122\101\115 \097\116\116\114\105\098\117\116\101\115",function()for G,f in pairs(u)do assert.same(f,z[G])end assert.is_false(z.started)assert.is_false(z.failed)assert.is_false(z.finished)assert.equal(0,z.count)assert.equal(0,z.damage)end)end)describe("\035\067\117\114\114\101\110\116\083\116\101\112\073\100",function()it("\114\097\105\115\101\115 \097\110 \101\114\114\111\114",function()local u=G.partial(z.CurrentStepId,z)assert.error(u,f.ERR_NOT_IMPLEMENTED)end)end)describe("\035\067\117\114\114\101\110\116\083\116\101\112",function()it("\114\097\105\115\101\115 \097\110 \101\114\114\111\114",function()local u=G.partial(z.CurrentStep,z)assert.error(u,f.ERR_NOT_IMPLEMENTED)end)end)describe("\035\078\101\120\116\083\116\101\112\115\073\100\115",function()it("\114\097\105\115\101\115 \097\110 \101\114\114\111\114",function()local u=G.partial(z.NextStepsIds,z)assert.error(u,f.ERR_NOT_IMPLEMENTED)end)end)describe("\035\078\101\120\116\083\116\101\112\115",function()it("\114\097\105\115\101\115 \097\110 \101\114\114\111\114",function()local u=G.partial(z.NextSteps,z)assert.error(u,f.ERR_NOT_IMPLEMENTED)end)end)describe("\035\080\114\111\103\114\101\115\115",function()it("\114\097\105\115\101\115 \097\110 \101\114\114\111\114",function()local u=G.partial(z.Progress,z,{})assert.error(u,f.ERR_NOT_IMPLEMENTED)end)end)describe("\035\070\097\105\108",function()it("\102\108\097\103\115 \116\104\101 \099\111\109\098\111 \097\115 \102\097\105\108\101\100",function()assert.is_false(z.failed)z:Fail()assert.is_true(z.failed)end)end)describe("\035\080\114\101\070\105\110\105\115\104",function()it("\114\097\105\115\101\115 \097\110 \101\114\114\111\114",function()local u=G.partial(z.PreFinish,z)assert.error(u,f.ERR_NOT_IMPLEMENTED)assert.is_false(z.preFinished)end)end)describe("\035\070\105\110\105\115\104",function()it("\114\097\105\115\101\115 \097\110 \101\114\114\111\114",function()local u=G.partial(z.Finish,z)assert.error(u,f.ERR_NOT_IMPLEMENTED)assert.is_false(z.finished)end)end)describe("\035\073\110\099\114\101\109\101\110\116\068\097\109\097\103\101",function()it("\105\110\099\114\101\109\101\110\116\115 \116\104\101 \100\097\109\097\103\101 \097\099\099\117\109\117\108\097\116\111\114 \097\110\100 \114\101\116\117\114\110\115 \116\104\101 \097\099\099\117\109\117\108\097\116\101\100 \118\097\108\117\101",function()assert.equal(13,z:IncrementDamage(13))assert.equal(13,z.damage)assert.equal(44,z:IncrementDamage(31))assert.equal(44,z.damage)end)end)end)
local m = require("moses")

local Talents = require("invokation.dota2.talents")
local BaseCombo = require("invokation.combos.BaseCombo")

local SPEC = {
  id = 13,
  specialty = "qw",
  stance = "defensive",
  heroLevel = 25,
  damageRating = 5,
  difficultyRating = 5,
  gold = 1234,
  tags = { "late-game" },
  items = { "item_blink" },
  orbs = { 7, 7, 7 },
  talents = Talents.Select(Talents.L10_LEFT, Talents.L15_RIGHT, Talents.L20_RIGHT, Talents.L25_RIGHT),
}

describe("BaseCombo", function()
  local combo

  before_each(function()
    combo = BaseCombo(SPEC)
  end)

  describe("constructor", function()
    it("initializes attributes", function()
      for key, value in pairs(SPEC) do
        assert.same(value, combo[key])
      end

      assert.is_false(combo.started)
      assert.is_false(combo.failed)
      assert.is_false(combo.finished)
      assert.equal(0, combo.count)
      assert.equal(0, combo.damage)
    end)
  end)

  describe("#CurrentStepId", function()
    it("raises an error", function()
      local fn = m.partial(combo.CurrentStepId, combo)
      assert.error(fn, BaseCombo.ERR_NOT_IMPLEMENTED)
    end)
  end)

  describe("#CurrentStep", function()
    it("raises an error", function()
      local fn = m.partial(combo.CurrentStep, combo)
      assert.error(fn, BaseCombo.ERR_NOT_IMPLEMENTED)
    end)
  end)

  describe("#NextStepsIds", function()
    it("raises an error", function()
      local fn = m.partial(combo.NextStepsIds, combo)
      assert.error(fn, BaseCombo.ERR_NOT_IMPLEMENTED)
    end)
  end)

  describe("#NextSteps", function()
    it("raises an error", function()
      local fn = m.partial(combo.NextSteps, combo)
      assert.error(fn, BaseCombo.ERR_NOT_IMPLEMENTED)
    end)
  end)

  describe("#Progress", function()
    it("raises an error", function()
      local fn = m.partial(combo.Progress, combo, {})
      assert.error(fn, BaseCombo.ERR_NOT_IMPLEMENTED)
    end)
  end)

  describe("#Fail", function()
    it("flags the combo as failed", function()
      assert.is_false(combo.failed)
      combo:Fail()
      assert.is_true(combo.failed)
    end)
  end)

  describe("#PreFinish", function()
    it("raises an error", function()
      local fn = m.partial(combo.PreFinish, combo)
      assert.error(fn, BaseCombo.ERR_NOT_IMPLEMENTED)
      assert.is_false(combo.preFinished)
    end)
  end)

  describe("#Finish", function()
    it("raises an error", function()
      local fn = m.partial(combo.Finish, combo)
      assert.error(fn, BaseCombo.ERR_NOT_IMPLEMENTED)
      assert.is_false(combo.finished)
    end)
  end)

  describe("#IncrementDamage", function()
    it("increments the damage accumulator and returns the accumulated value", function()
      assert.equal(13, combo:IncrementDamage(13))
      assert.equal(13, combo.damage)
      assert.equal(44, combo:IncrementDamage(31))
      assert.equal(44, combo.damage)
    end)
  end)
end)
