27 lines
715 B
GDScript
27 lines
715 B
GDScript
extends GutTest
|
|
|
|
func before_each():
|
|
Economy.init_player(0, 200, 3)
|
|
|
|
func test_initial_minerals():
|
|
assert_eq(Economy.get_minerals(0), 200)
|
|
|
|
func test_spend_minerals_success():
|
|
var ok = Economy.spend_minerals(0, 75)
|
|
assert_true(ok)
|
|
assert_eq(Economy.get_minerals(0), 125)
|
|
|
|
func test_spend_minerals_insufficient():
|
|
var ok = Economy.spend_minerals(0, 999)
|
|
assert_false(ok)
|
|
assert_eq(Economy.get_minerals(0), 200)
|
|
|
|
func test_income_accumulates():
|
|
Economy.add_income(0, 20)
|
|
Economy.add_income(0, 10)
|
|
assert_eq(Economy.get_income(0), 80) # 50 base + 30 bonus
|
|
|
|
func test_income_phase_pays_out():
|
|
var before = Economy.get_minerals(0)
|
|
Economy.process_income_phase()
|
|
assert_gt(Economy.get_minerals(0), before)
|