Пример #1
0
def test_percentage_bonus_affects_primary_stat_but_not_flat_bonus(hero_level, percentage_bonus, flat_bonus):
	"""
	>>> damage = test_percentage_bonus_affects_primary_stat_but_not_flat_bonus("0", "0", "0")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_percentage_bonus_affects_primary_stat_but_not_flat_bonus("2", "0", "0")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	64
	>>> damage = test_percentage_bonus_affects_primary_stat_but_not_flat_bonus("2", "100", "0")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	127
	>>> damage = test_percentage_bonus_affects_primary_stat_but_not_flat_bonus("2", "", "14")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	78
	>>> damage = test_percentage_bonus_affects_primary_stat_but_not_flat_bonus("2", "100", "14")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	141
	"""
	injector = UIUnitTestInjector("Bloodseeker", "", hero_level, "", [], [], percentage_bonus, flat_bonus, "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #2
0
def test_empty_initalization():
	"""
	>>> damage = test_empty_initalization()
	Injecting unit test values in Central object
	Placeholder attacking Placeholder...
	0
	>>> damage
	0
	"""
	injector = UIUnitTestInjector("", "", "", "", [], [], "", "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #3
0
def test_bad_level_input_sanitized():
	"""
	>>> damage = test_bad_level_input_sanitized()
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage
	47
	"""
	injector = UIUnitTestInjector("Bloodseeker", "Phantom Assassin", "-7", "awxcesvtdb", [], [], "", "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #4
0
def test_hero_choice_initalization_defender_only():
	"""
	>>> damage = test_hero_choice_initalization_defender_only()
	Injecting unit test values in Central object
	Placeholder attacking Phantom Assassin...
	0
	>>> damage
	0
	"""
	injector = UIUnitTestInjector("", "Phantom Assassin", "", "", [], [], "", "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #5
0
def test_hero_choice_initalization_both():
	"""
	>>> damage = test_hero_choice_initalization_both()
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage
	47
	"""
	injector = UIUnitTestInjector("Bloodseeker", "Phantom Assassin", "", "", [], [], "", "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #6
0
def test_bad_hero_names_sanitized():
	"""
	>>> damage = test_bad_hero_names_sanitized()
	Injecting unit test values in Central object
	Placeholder attacking Placeholder...
	0
	>>> damage
	0
	"""
	injector = UIUnitTestInjector("acrslnvciw3ina", "fac4soexuntcl", "", "", [], [], "", "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #7
0
def test_hero_choice_initalization_attacker_only():
	"""
	>>> damage = test_hero_choice_initalization_attacker_only()
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage
	60
	"""
	injector = UIUnitTestInjector("Bloodseeker", "", "", "", [], [], "", "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #8
0
def test_invalid_block_source_provided(block_source):
	"""
	>>> damage = test_invalid_block_source_provided("")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_invalid_block_source_provided("abcde")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	"""
	injector = UIUnitTestInjector("Bloodseeker", "", "", "", [], [], "", "", block_source, "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #9
0
def test_flat_bonuses_influeced_by_crit(attacker_items, crit_source_name):
	"""
	>>> damage = test_flat_bonuses_influeced_by_crit(["Shadow Blade (exiting invis)"], "")
	Injecting unit test values in Central object
	Placeholder attacking Placeholder...
	197
	>>> damage = test_flat_bonuses_influeced_by_crit(["Shadow Blade (exiting invis)"], "Drunken Brawler (guaranteed crit) level 1")
	Injecting unit test values in Central object
	Placeholder attacking Placeholder...
	276
	"""
	injector = UIUnitTestInjector("", "", "", "", attacker_items, [], "", "", "", crit_source_name, "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #10
0
def test_hero_level_scaling(attacker_level, defender_level):
	"""
	>>> damage = test_hero_choice_initalization_both()
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage
	47
	>>> damage = test_hero_level_scaling("1", "1")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage
	47
	>>> damage = test_hero_level_scaling("1", "1")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage
	47
	>>> damage = test_hero_level_scaling("5", "1")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	58
	>>> damage
	58
	>>> damage = test_hero_level_scaling("17", "1")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	91
	>>> damage
	91
	>>> damage = test_hero_level_scaling("17", "11")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	71
	>>> damage
	71
	>>> damage = test_hero_level_scaling("17", "25")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	53
	>>> damage
	53
	"""
	injector = UIUnitTestInjector("Bloodseeker", "Phantom Assassin", attacker_level, defender_level, [], [], "", "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #11
0
def test_block_damage_applies_after_attack_multipliers(hero_level, percentage_bonus, flat_bonus, block_source):
	"""
	>>> damage = test_block_damage_applies_after_attack_multipliers("0", "0", "0", "")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_block_damage_applies_after_attack_multipliers("0", "0", "0", "Crimson Guard active")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	0
	>>> damage = test_block_damage_applies_after_attack_multipliers("2", "0", "0", "")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	64
	>>> damage = test_block_damage_applies_after_attack_multipliers("2", "0", "0", "Crimson Guard active")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	4
	>>> damage = test_block_damage_applies_after_attack_multipliers("2", "100", "0", "")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	127
	>>> damage = test_block_damage_applies_after_attack_multipliers("2", "100", "0", "Crimson Guard active")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	67
	>>> damage = test_block_damage_applies_after_attack_multipliers("2", "", "14", "")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	78
	>>> damage = test_block_damage_applies_after_attack_multipliers("2", "", "14", "Crimson Guard active")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	18
	>>> damage = test_block_damage_applies_after_attack_multipliers("2", "100", "14", "")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	141
	>>> damage = test_block_damage_applies_after_attack_multipliers("2", "100", "14", "Crimson Guard active")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	81
	"""
	injector = UIUnitTestInjector("Bloodseeker", "", hero_level, "", [], [], percentage_bonus, flat_bonus, block_source, "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #12
0
def test_crit_comes_before_block_in_formula(block_source, crit_source):
	"""
	>>> damage = test_crit_comes_before_block_in_formula("", "")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_crit_comes_before_block_in_formula("Stout Shield (melee)", "Drunken Brawler (guaranteed crit) level 4")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	146
	>>> damage = test_crit_comes_before_block_in_formula("Crimson Guard active", "Drunken Brawler (guaranteed crit) level 4")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	96
	"""
	injector = UIUnitTestInjector("Bloodseeker", "", "", "", [], [], "", "", block_source, crit_source, "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #13
0
def test_invalid_crit_value_provided(crit_source):
	"""
	>>> damage = test_invalid_crit_value_provided("")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_invalid_crit_value_provided("Drunken Brawler (guaranteed crit) level 4")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	156
	>>> damage = test_invalid_crit_value_provided("Drunken Brawler (zzzzz) level 4")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	"""
	injector = UIUnitTestInjector("Bloodseeker", "", "", "", [], [], "", "", "", crit_source, "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #14
0
def test_default_level_values_round_to_one():
	"""
	>>> damage1 = test_hero_level_scaling("1", "1")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage1
	47
	>>> damage2 = test_hero_level_scaling("1", "1")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage1 == damage2
	True
	"""
	injector = UIUnitTestInjector("Bloodseeker", "Phantom Assassin", Central.HERO_LEVEL_DEFAULT, Central.HERO_LEVEL_DEFAULT, [], [], "", "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #15
0
def test_general_multipliers_inputs(general_multipliers):
	"""
	>>> damage = test_general_multipliers_inputs("")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_general_multipliers_inputs("100")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_general_multipliers_inputs("200")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	120
	>>> damage = test_general_multipliers_inputs("200%")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	120
	>>> damage = test_general_multipliers_inputs("50, 50%")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	15
	>>> damage = test_general_multipliers_inputs("50, 50%,33")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	5
	>>> damage = test_general_multipliers_inputs("50, 50%,33x")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	<BLANKLINE>
	Invalid percentage given: 33x. Skipping over value.
	15
	>>> damage = test_general_multipliers_inputs(",50,,, 50%,,33,")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	5
	>>> damage = test_general_multipliers_inputs(",,,,,,       ,, ,,, ,,,, ,")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	"""
	injector = UIUnitTestInjector("Bloodseeker", "", "", "", [], [], "", "", "", "", general_multipliers)
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #16
0
def test_percent_bonus(percent_bonus):
	"""
	>>> damage = test_hero_choice_initalization_both()
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage = test_percent_bonus("0")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage = test_percent_bonus("5%")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	49
	>>> damage = test_percent_bonus("5")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	49
	>>> damage = test_percent_bonus("5.0")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	49
	>>> damage = test_percent_bonus("5.0%")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	49
	>>> damage = test_percent_bonus("5.0%,17.9,26%")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	70
	>>> damage = test_percent_bonus("x,5.0%,17.9,26%")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	<BLANKLINE>
	Invalid percentage given: x. Skipping over value.
	70
	"""
	injector = UIUnitTestInjector("Bloodseeker", "Phantom Assassin", "", "", [], [], percent_bonus, "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #17
0
def test_general_multipliers_last_in_formula(crit_source, block_source, general_multipliers):
	"""
	>>> damage = test_general_multipliers_last_in_formula("", "", "")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_general_multipliers_last_in_formula("Stout Shield (melee)", "", "")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	50
	>>> damage = test_general_multipliers_last_in_formula("Stout Shield (melee)", "Drunken Brawler (guaranteed crit) level 4", "")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	146
	>>> damage = test_general_multipliers_last_in_formula("Stout Shield (melee)", "Drunken Brawler (guaranteed crit) level 4", "50%")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	73
	"""
	injector = UIUnitTestInjector("Bloodseeker", "", "", "", [], [], "", "", crit_source, block_source, general_multipliers)
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #18
0
def test_expected_block_value_used(block_source):
	"""
	>>> damage = test_expected_block_value_used("")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_expected_block_value_used("Stout Shield (melee)")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	50
	>>> damage = test_expected_block_value_used("Stout Shield (ranged)")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	56
	>>> damage = test_expected_block_value_used("Crimson Guard active")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	0
	"""
	injector = UIUnitTestInjector("Bloodseeker", "", "", "", [], [], "", "", block_source, "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #19
0
def test_percent_stacking_values(percent_bonus):
	"""
	>>> damage = test_percent_stacking_values("0,0,0,0,0,0,0")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> test_percent_stacking_values("1,1,1,1,1") == test_percent_stacking_values("5")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	63
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	63
	True
	>>> damage = test_percent_stacking_values("1,2,3,4")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	66
	>>> damage = test_percent_stacking_values("100, 100, 100, 100, 100")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	360
	>>> damage = test_percent_stacking_values("-100") #Negative attacker percentages do not exist and are banned
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_percent_stacking_values("-1")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	>>> damage = test_percent_stacking_values("-1000")
	Injecting unit test values in Central object
	Bloodseeker attacking Placeholder...
	60
	"""
	injector = UIUnitTestInjector("Bloodseeker", "", "", "", [], [], percent_bonus, "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #20
0
def test_flat_bonus(flat_damage):
	"""
	>>> damage = test_hero_choice_initalization_both()
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage = test_flat_bonus("0")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	47
	>>> damage = test_flat_bonus("21")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	63
	>>> damage = test_flat_bonus("21, 21")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	80
	>>> damage = test_flat_bonus("21, 21,")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	80
	>>> damage = test_flat_bonus(",21, 21,")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	80
	>>> damage = test_flat_bonus("x")
	Injecting unit test values in Central object
	Bloodseeker attacking Phantom Assassin...
	<BLANKLINE>
	Invalid integer given: x. Skipping over value.
	47
	"""
	injector = UIUnitTestInjector("Bloodseeker", "Phantom Assassin", "", "", [], [], "", flat_damage, "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()
Пример #21
0
from central import Central
import tkinter

app = Central(tkinter.Tk())
app.run()
Пример #22
0
def item_injector(attacker, defender, attacker_items, defender_items):
	injector = UIUnitTestInjector(attacker, defender, "", "", attacker_items, defender_items, "", "", "", "", "")
	ui = Central(tkinter.Tk(), injector)
	return ui.calculate_damage_for_single_sample()