Skip to content

Commit 4702aef

Browse files
committed
test(decorators): move a repeater test to the DecoratorTest class
Now that DecoratorBase returns failure if it has no child, Does_not_crash_if_no_child can be moved to the base decorator tests
1 parent 1eecfb6 commit 4702aef

File tree

4 files changed

+8
-22
lines changed

4 files changed

+8
-22
lines changed

Assets/FluidBehaviorTree/Tests/Editor/Decorators/DecoratorTest.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using CleverCrow.Fluid.BTs.Decorators;
1+
using CleverCrow.Fluid.BTs.Decorators;
22
using CleverCrow.Fluid.BTs.Tasks;
33
using NSubstitute;
44
using NUnit.Framework;
@@ -50,6 +50,13 @@ public void It_should_return_failure_if_a_child_is_missing () {
5050
_decorator.Children.RemoveAt(0);
5151
Assert.AreEqual(TaskStatus.Failure, _decorator.Update());
5252
}
53+
54+
[Test]
55+
public void Does_not_crash_if_no_child () {
56+
_decorator.Children.RemoveAt(0);
57+
58+
Assert.DoesNotThrow(() => _decorator.Update());
59+
}
5360
}
5461

5562
public class EndMethod : DecoratorTest {

Assets/FluidBehaviorTree/Tests/Editor/Decorators/RepeatForeverTest.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ public void Returns_continue_on_child_continue () {
2828

2929
Assert.AreEqual(TaskStatus.Continue, repeater.Update());
3030
}
31-
32-
[Test]
33-
public void Does_not_crash_if_no_child () {
34-
var repeater = new RepeatForever();
35-
36-
Assert.DoesNotThrow(() => repeater.Update());
37-
}
3831
}
3932
}
4033
}

Assets/FluidBehaviorTree/Tests/Editor/Decorators/RepeatUntilFailureTest.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ public void Returns_continue_on_child_continue () {
2828

2929
Assert.AreEqual(TaskStatus.Continue, repeater.Update());
3030
}
31-
32-
[Test]
33-
public void Does_not_crash_if_no_child () {
34-
var repeater = new RepeatUntilFailure();
35-
36-
Assert.DoesNotThrow(() => repeater.Update());
37-
}
3831
}
3932
}
4033
}

Assets/FluidBehaviorTree/Tests/Editor/Decorators/RepeatUntilSuccessTest.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ public void Returns_continue_on_child_continue () {
2828

2929
Assert.AreEqual(TaskStatus.Continue, repeater.Update());
3030
}
31-
32-
[Test]
33-
public void Does_not_crash_if_no_child () {
34-
var repeater = new RepeatUntilSuccess();
35-
36-
Assert.DoesNotThrow(() => repeater.Update());
37-
}
3831
}
3932
}
4033
}

0 commit comments

Comments
 (0)