Skip to content

Commit

Permalink
tweak test timings
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbrain committed Nov 17, 2023
1 parent b8e0763 commit 319eb1e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/nodes/decorators/time_limiter_test.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ var runner:GdUnitSceneRunner

func before_test() -> void:
tree = auto_free(load(__tree).new())
action = auto_free(load(__action).new())
time_limiter = auto_free(load(__source).new())
runner = scene_runner(tree)

actor = auto_free(Node2D.new())
blackboard = auto_free(load(__blackboard).new())

tree.add_child(time_limiter)
time_limiter.add_child(action)

tree.actor = actor
tree.blackboard = blackboard
action = auto_free(load(__action).new())
time_limiter = auto_free(load(__source).new())

time_limiter.add_child(action)
tree.add_child(time_limiter)

runner = scene_runner(tree)


func test_return_failure_when_child_exceeds_time_limiter() -> void:
time_limiter.wait_time = 0.3
time_limiter.wait_time = 0.1
action.status = BeehaveNode.RUNNING
await runner.simulate_frames(1, 10)
assert_that(tree.tick()).is_equal(BeehaveNode.RUNNING)
Expand All @@ -44,7 +44,7 @@ func test_return_failure_when_child_exceeds_time_limiter() -> void:


func test_reset_when_child_finishes() -> void:
time_limiter.wait_time = 1.0
time_limiter.wait_time = 0.5
action.status = BeehaveNode.RUNNING
await runner.simulate_frames(1, 10)
assert_that(tree.tick()).is_equal(BeehaveNode.RUNNING)
Expand All @@ -54,7 +54,7 @@ func test_reset_when_child_finishes() -> void:


func test_clear_running_child_after_run() -> void:
time_limiter.wait_time = 1.0
time_limiter.wait_time = 0.2
action.status = BeehaveNode.RUNNING
await runner.simulate_frames(1)
assert_that(time_limiter.running_child).is_equal(action)
Expand Down

0 comments on commit 319eb1e

Please sign in to comment.