feat(sprint-14): add Cake cut/reset state machine
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
## Tests for Cake — state machine transitions.
|
||||
extends GutTest
|
||||
|
||||
const CakeScript = preload("res://scripts/objects/cake.gd")
|
||||
|
||||
var _cake: Node2D
|
||||
|
||||
|
||||
func before_each() -> void:
|
||||
_cake = CakeScript.new()
|
||||
add_child_autofree(_cake)
|
||||
|
||||
|
||||
func test_initial_state_is_whole() -> void:
|
||||
assert_eq(_cake._state, CakeScript.State.WHOLE)
|
||||
|
||||
|
||||
func test_start_cutting_transitions_to_cutting() -> void:
|
||||
_cake._start_cutting()
|
||||
assert_eq(_cake._state, CakeScript.State.CUTTING)
|
||||
|
||||
|
||||
func test_on_cut_complete_transitions_to_cut() -> void:
|
||||
_cake._on_cut_complete()
|
||||
assert_eq(_cake._state, CakeScript.State.CUT)
|
||||
|
||||
|
||||
func test_on_reset_complete_transitions_to_whole() -> void:
|
||||
_cake._state = CakeScript.State.RESETTING
|
||||
_cake._on_reset_complete()
|
||||
assert_eq(_cake._state, CakeScript.State.WHOLE)
|
||||
Reference in New Issue
Block a user