Decouples core systems from centralized globals in favor of catalogue-based architecture and data-driven content. Key changes: - Prestige: node-based buff tech tree, graph panel, progress bar - Research: multi-worker system, per-generator research, xp generation - Ascension: meta-currency layer via multi-currency prestige resets - Buffs: refactored as generator-independent via catalogues - UI: currency panel, edge-scrolling camera + zoom, current-goal panel - Alchemy Tower: crafting building with recipe/cost system - Testing: 7 test suites (ascension, prestige, research, goals) - Content: migrated from hardcoded idles/ to gym format (tiny_sword)
75 lines
2.2 KiB
GDScript
75 lines
2.2 KiB
GDScript
class_name TestUtils
|
|
extends RefCounted
|
|
|
|
static var _test_name: String = ""
|
|
static var _passed: int = 0
|
|
static var _failed: int = 0
|
|
|
|
static func set_test_name(name: String) -> void:
|
|
_test_name = name
|
|
_passed = 0
|
|
_failed = 0
|
|
|
|
static func assert_equals(expected: Variant, actual: Variant, message: String) -> void:
|
|
if expected == actual:
|
|
print("[PASS] %s: %s" % [_test_name, message])
|
|
_passed += 1
|
|
else:
|
|
print("[FAIL] %s: %s (expected %s, got %s)" % [
|
|
_test_name, message, str(expected), str(actual)
|
|
])
|
|
_failed += 1
|
|
|
|
static func assert_true(condition: bool, message: String) -> void:
|
|
if condition:
|
|
print("[PASS] %s: %s" % [_test_name, message])
|
|
_passed += 1
|
|
else:
|
|
print("[FAIL] %s: %s" % [_test_name, message])
|
|
_failed += 1
|
|
|
|
static func assert_false(condition: bool, message: String) -> void:
|
|
if not condition:
|
|
print("[PASS] %s: %s" % [_test_name, message])
|
|
_passed += 1
|
|
else:
|
|
print("[FAIL] %s: %s (expected false, got true)" % [_test_name, message])
|
|
_failed += 1
|
|
|
|
static func assert_greater_than(a: float, b: float, message: String) -> void:
|
|
if a > b:
|
|
print("[PASS] %s: %s" % [_test_name, message])
|
|
_passed += 1
|
|
else:
|
|
print("[FAIL] %s: %s (expected %s > %s)" % [_test_name, message, str(a), str(b)])
|
|
_failed += 1
|
|
|
|
static func assert_greater_or_equal(a: float, b: float, message: String) -> void:
|
|
if a >= b:
|
|
print("[PASS] %s: %s" % [_test_name, message])
|
|
_passed += 1
|
|
else:
|
|
print("[FAIL] %s: %s (expected %s >= %s)" % [_test_name, message, str(a), str(b)])
|
|
_failed += 1
|
|
|
|
static func assert_not_null(value: Variant, message: String) -> void:
|
|
if value != null:
|
|
print("[PASS] %s: %s" % [_test_name, message])
|
|
_passed += 1
|
|
else:
|
|
print("[FAIL] %s: %s" % [_test_name, message])
|
|
_failed += 1
|
|
|
|
static func get_passed() -> int:
|
|
return _passed
|
|
|
|
static func get_failed() -> int:
|
|
return _failed
|
|
|
|
static func print_result() -> void:
|
|
print("[SUMMARY] %s: %d passed, %d failed" % [_test_name, _passed, _failed])
|
|
if _failed == 0:
|
|
print("[RESULT] PASS")
|
|
else:
|
|
print("[RESULT] FAIL")
|