diff options
author | Manoj Srivastava <srivasta@debian.org> | 2016-01-27 12:43:59 -0800 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2016-01-27 12:50:09 -0800 |
commit | 76fce162659078323fcd5e54b3195dae371faca2 (patch) | |
tree | c1d93d415b96238aae3c54eb83cb0815af2e4bca /tests/lua_get_level.cc | |
parent | b4456969cd02d75c599a5b86b225c0774697e85d (diff) | |
parent | 4aa1a39402c3908e9e8b6eb3fd4e2183d5e5c52e (diff) |
Merge branch 'development' into upstream
Signed-off-by: Manoj Srivastava <srivasta@debian.org>
# Conflicts:
# src/.gitignore
# src/maid-x11.c
# src/quest.pkg
Diffstat (limited to 'tests/lua_get_level.cc')
-rw-r--r-- | tests/lua_get_level.cc | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/tests/lua_get_level.cc b/tests/lua_get_level.cc new file mode 100644 index 00000000..a434903e --- /dev/null +++ b/tests/lua_get_level.cc @@ -0,0 +1,135 @@ +#include "lua_bind.hpp" +#include "spell_type.hpp" +#include <bandit/bandit.h> +using namespace bandit; + +go_bandit([]() { + describe("lua_get_level", []() { + + auto createEntsPotion = ([]() { + auto my_spell = spell_type_new("TEST: Ent's Potion"); + spell_type_set_difficulty(my_spell, 6, 35); // Copied from standard Ent's Potion spell. + return my_spell; + }); + + auto createSenseHidden = ([]() { + auto my_spell = spell_type_new("TEST: Sense Hidden"); + spell_type_set_difficulty(my_spell, 5, 25); // Copied from standard Sense Hidden spell. + return my_spell; + }); + + // + // Test cases derived from empirical testing of the code before refactoring. + // + + it("calculates \"Ent's Potion\" level appropriately for Sorcery@1.0", [&](){ + // Setup + auto my_spell = createEntsPotion(); + // Exercise + auto actualResult = lua_get_level(my_spell, 100, 50, -50, 0); + // Verify + AssertThat(actualResult, Equals(-4)); + }); + + it("calculates \"Ent's Potion\" cost appropriately for Sorcery@1.0", [&](){ + // Setup + auto my_spell = createEntsPotion(); + // Exercise + auto actualResult = lua_get_level(my_spell, 100, 15, 7, 0); + // Verify + AssertThat(actualResult, Equals(7)); + }); + + it("calculates \"Ent's Potion\" level appropriately for Sorcery@25.0", [&](){ + // Setup + auto my_spell = createEntsPotion(); + // Exercise + auto actualResult = lua_get_level(my_spell, 2500, 50, 1, 0); + // Verify + AssertThat(actualResult, Equals(20)); + }); + + it("calculates \"Ent's Potion\" cost appropriately for Sorcery@25.0", [&](){ + // Setup + auto my_spell = createEntsPotion(); + // Exercise + auto actualResult = lua_get_level(my_spell, 2500, 15, 7, 0); + // Verify + AssertThat(actualResult, Equals(7)); + }); + + it("calculates \"Ent's Potion\" level appropriately for Sorcery@25.0 with +3 equipment SP bonus", [&](){ + // Setup + auto my_spell = createEntsPotion(); + // Exercise + auto actualResult = lua_get_level(my_spell, 2500, 50, 1, 300); + // Verify + AssertThat(actualResult, Equals(23)); + }); + + it("calculates \"Ent's Potion\" cost appropriately for Sorcery@25.0 with +3 equipment SP bonus", [&](){ + // Setup + auto my_spell = createEntsPotion(); + // Exercise + auto actualResult = lua_get_level(my_spell, 2500, 15, 7, 300); + // Verify + AssertThat(actualResult, Equals(7)); + + }); + + it("calculates \"Sense Hidden\" level appropriately for Sorcery@1.0", [&](){ + // Setup + auto my_spell = createSenseHidden(); + // Exercise + auto actualResult = lua_get_level(my_spell, 100, 50, -50, 0); + // Verify + AssertThat(actualResult, Equals(-3)); + }); + + it("calculates \"Sense Hidden\" cost appropriately for Sorcery@1.0", [&](){ + // Setup + auto my_spell = createSenseHidden(); + // Exercise + auto actualResult = lua_get_level(my_spell, 100, 10, 2, 0); + // Verify + AssertThat(actualResult, Equals(2)); + }); + + it("calculates \"Sense Hidden\" level appropriately for Sorcery@25.0", [&](){ + // Setup + auto my_spell = createSenseHidden(); + // Exercise + auto actualResult = lua_get_level(my_spell, 2500, 50, 1, 0); + // Verify + AssertThat(actualResult, Equals(21)); + }); + + it("calculates \"Sense Hidden\" cost appropriately for Sorcery@25.0", [&](){ + // Setup + auto my_spell = createSenseHidden(); + // Exercise + auto actualResult = lua_get_level(my_spell, 2500, 10, 2, 0); + // Verify + AssertThat(actualResult, Equals(4)); + }); + + it("calculates \"Sense Hidden\" level appropriately for Sorcery@25.0 with +3 equipment SP bonus", [&](){ + // Setup + auto my_spell = createSenseHidden(); + // Exercise + auto actualResult = lua_get_level(my_spell, 2500, 50, 1, 300); + // Verify + AssertThat(actualResult, Equals(24)); + }); + + it("calculates \"Sense Hidden\" cost appropriately for Sorcery@25.0 with +3 equipment SP bonus", [&](){ + // Setup + auto my_spell = createSenseHidden(); + // Exercise + auto actualResult = lua_get_level(my_spell, 2500, 10, 2, 300); + // Verify + AssertThat(actualResult, Equals(4)); + }); + + }); +}); |