87 lines
3.0 KiB
GDScript
87 lines
3.0 KiB
GDScript
extends GutTest
|
|
|
|
## Unit tests to verify AttackStep enum alignment between client and server
|
|
## Server uses: NONE=0, PREPARATION=1, DECLARATION=2, BLOCK_DECLARATION=3, DAMAGE_RESOLUTION=4
|
|
|
|
|
|
## Test that AttackStep enum values match expected server values
|
|
## Critical for network synchronization
|
|
|
|
func test_attack_step_none_equals_zero():
|
|
assert_eq(Enums.AttackStep.NONE, 0, "AttackStep.NONE should be 0 to match server")
|
|
|
|
|
|
func test_attack_step_preparation_equals_one():
|
|
assert_eq(Enums.AttackStep.PREPARATION, 1, "AttackStep.PREPARATION should be 1 to match server")
|
|
|
|
|
|
func test_attack_step_declaration_equals_two():
|
|
assert_eq(Enums.AttackStep.DECLARATION, 2, "AttackStep.DECLARATION should be 2 to match server")
|
|
|
|
|
|
func test_attack_step_block_declaration_equals_three():
|
|
assert_eq(Enums.AttackStep.BLOCK_DECLARATION, 3, "AttackStep.BLOCK_DECLARATION should be 3 to match server")
|
|
|
|
|
|
func test_attack_step_damage_resolution_equals_four():
|
|
assert_eq(Enums.AttackStep.DAMAGE_RESOLUTION, 4, "AttackStep.DAMAGE_RESOLUTION should be 4 to match server")
|
|
|
|
|
|
## Test enum ordering is correct
|
|
func test_attack_step_enum_order():
|
|
# Verify the enum values are in correct order
|
|
assert_true(
|
|
Enums.AttackStep.NONE < Enums.AttackStep.PREPARATION,
|
|
"NONE should be less than PREPARATION"
|
|
)
|
|
assert_true(
|
|
Enums.AttackStep.PREPARATION < Enums.AttackStep.DECLARATION,
|
|
"PREPARATION should be less than DECLARATION"
|
|
)
|
|
assert_true(
|
|
Enums.AttackStep.DECLARATION < Enums.AttackStep.BLOCK_DECLARATION,
|
|
"DECLARATION should be less than BLOCK_DECLARATION"
|
|
)
|
|
assert_true(
|
|
Enums.AttackStep.BLOCK_DECLARATION < Enums.AttackStep.DAMAGE_RESOLUTION,
|
|
"BLOCK_DECLARATION should be less than DAMAGE_RESOLUTION"
|
|
)
|
|
|
|
|
|
## Test TurnPhase enum alignment with server as well
|
|
## Server uses: ACTIVE=0, DRAW=1, MAIN_1=2, ATTACK=3, MAIN_2=4, END=5
|
|
|
|
func test_turn_phase_active_equals_zero():
|
|
assert_eq(Enums.TurnPhase.ACTIVE, 0, "TurnPhase.ACTIVE should be 0 to match server")
|
|
|
|
|
|
func test_turn_phase_draw_equals_one():
|
|
assert_eq(Enums.TurnPhase.DRAW, 1, "TurnPhase.DRAW should be 1 to match server")
|
|
|
|
|
|
func test_turn_phase_main_1_equals_two():
|
|
assert_eq(Enums.TurnPhase.MAIN_1, 2, "TurnPhase.MAIN_1 should be 2 to match server")
|
|
|
|
|
|
func test_turn_phase_attack_equals_three():
|
|
assert_eq(Enums.TurnPhase.ATTACK, 3, "TurnPhase.ATTACK should be 3 to match server")
|
|
|
|
|
|
func test_turn_phase_main_2_equals_four():
|
|
assert_eq(Enums.TurnPhase.MAIN_2, 4, "TurnPhase.MAIN_2 should be 4 to match server")
|
|
|
|
|
|
func test_turn_phase_end_equals_five():
|
|
assert_eq(Enums.TurnPhase.END, 5, "TurnPhase.END should be 5 to match server")
|
|
|
|
|
|
## Test that all enum values are present
|
|
func test_attack_step_has_five_values():
|
|
var values = Enums.AttackStep.values()
|
|
assert_eq(values.size(), 5, "AttackStep should have 5 values (NONE, PREPARATION, DECLARATION, BLOCK_DECLARATION, DAMAGE_RESOLUTION)")
|
|
|
|
|
|
func test_turn_phase_has_six_values():
|
|
var values = Enums.TurnPhase.values()
|
|
assert_eq(values.size(), 6, "TurnPhase should have 6 values (ACTIVE, DRAW, MAIN_1, ATTACK, MAIN_2, END)")
|