File tree Expand file tree Collapse file tree 6 files changed +52
-20
lines changed
test/java/org/bk/ass/grid Expand file tree Collapse file tree 6 files changed +52
-20
lines changed Original file line number Diff line number Diff line change 5
5
/**
6
6
* A behavior tree. Main difference to other compound nodes is that the actual root tree node is
7
7
* constructed on initialization.
8
- * <p/ >
8
+ * <p>
9
9
* This allows data oriented programming, with simplified access to some data:
10
10
* <pre>
11
11
* {@code
Original file line number Diff line number Diff line change 18
18
* This is like <code>map</code> for streams. Maps each item of a given list to a node. New nodes
19
19
* will only be created for new items. Nodes for items that are no longer present will be aborted
20
20
* and discarded.
21
- * <p/ >
21
+ * <p>
22
22
* The created child nodes will be executed in parallel in the order of the item list.
23
23
*
24
24
* @param <T> the type of the item used to create new nodes
Original file line number Diff line number Diff line change 1
1
package org .bk .ass .bt ;
2
2
3
3
/**
4
- * Delegates execution but returns the inverted status (ie. failed -> success; success -> failed;
5
- * running -> running).
4
+ * Delegates execution but returns the inverted status (ie. failed → success; success → failed;
5
+ * running → running).
6
6
*/
7
7
public class Inverter extends Decorator {
8
8
Original file line number Diff line number Diff line change 5
5
/**
6
6
* Repeatedly ticks a delegate node. If the delegate completes its operation, it will automatically
7
7
* be resetted and re-ticked.
8
- * <p/ >
8
+ * <p>
9
9
* An internal {@link Policy} is used to determine the status of the Repeat node based on the result
10
10
* of the delegate.
11
- * <p/ >
11
+ * <p>
12
12
* Use {@link Policy#SEQUENCE} to tick a delegate as long as it is succeeding. Use {@link
13
13
* Policy#SELECTOR} to tick a delegate until it succeeds. Use {@link Policy#SELECTOR_INVERTED} to
14
14
* tick a delegate until it fails.
Original file line number Diff line number Diff line change
1
+ package org .bk .ass .grid ;
2
+
3
+ import static org .assertj .core .api .Assertions .assertThat ;
4
+
5
+ import org .junit .jupiter .api .Test ;
6
+
7
+ class BooleanGridTest {
8
+
9
+ @ Test
10
+ void shouldDiscardValueOnVersionUpdate () {
11
+ // GIVEN
12
+ BooleanGrid sut = new BooleanGrid (10 , 10 );
13
+ sut .set (1 , 1 , true );
14
+
15
+ // WHEN
16
+ sut .updateVersion ();
17
+
18
+ // THEN
19
+ assertThat (sut .get (1 , 1 )).isFalse ();
20
+ }
21
+
22
+ @ Test
23
+ void shouldSetValue () {
24
+ // GIVEN
25
+ BooleanGrid sut = new BooleanGrid (10 , 10 );
26
+
27
+ // WHEN
28
+ sut .set (1 , 1 , true );
29
+
30
+ // THEN
31
+ assertThat (sut .get (1 , 1 )).isTrue ();
32
+ }
33
+
34
+ @ Test
35
+ void shouldUnsetValue () {
36
+ // GIVEN
37
+ BooleanGrid sut = new BooleanGrid (10 , 10 );
38
+ sut .set (1 , 1 , true );
39
+
40
+ // WHEN
41
+ sut .set (1 , 1 , false );
42
+
43
+ // THEN
44
+ assertThat (sut .get (1 , 1 )).isFalse ();
45
+ }
46
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments