|
1 | 1 | using System; using NUnit.Framework; |
2 | | -using static Activ.GOAP.Solver<Activ.GOAP.Agent>; |
| 2 | +using static Activ.GOAP.Solver<Activ.GOAP.Idler>; |
3 | 3 |
|
4 | 4 | namespace Activ.GOAP{ |
5 | 5 | public class NodeSetTest : TestBase{ |
6 | 6 |
|
7 | | - NodeSet<Agent> x; |
| 7 | + NodeSet<Idler> x; |
8 | 8 | Idler idler = new Idler(); |
9 | 9 |
|
10 | 10 | [SetUp] public void Setup() |
11 | | - => x = new NodeSet<Agent>(idler, null); |
| 11 | + => x = new NodeSet<Idler>(idler, null); |
12 | 12 |
|
13 | 13 | [Test] public void InitStateMustExist () |
14 | 14 | => Assert.Throws<NullReferenceException>( |
15 | | - () => new NodeSet<Agent>(null, null)); |
| 15 | + () => new NodeSet<Idler>(null, null)); |
16 | 16 |
|
17 | 17 | [Test] public void TrueWithinCapacity() |
18 | 18 | { if(x){ } else Assert.Fail(); } |
19 | 19 |
|
20 | 20 | [Test] public void FalseOverCapacity() |
21 | | - { o((bool)new NodeSet<Agent>(idler, null, capacity: 0), false); } |
| 21 | + { o((bool)new NodeSet<Idler>(idler, null, capacity: 0), false); } |
22 | 22 |
|
23 | 23 | [Test] public void FalseWhenEmpty() |
24 | 24 | { x.Pop(); o( (bool)x, false); } |
25 | 25 |
|
26 | 26 | [Test] public void InsertAndSkipExisting() |
27 | | - { x.Insert(new Node<Agent>("x", idler)); o( x.count, 1); } |
| 27 | + { x.Insert(new Node<Idler>("x", idler)); o( x.count, 1); } |
28 | 28 |
|
29 | 29 | [Test] public void InsertUnsorted(){ |
30 | | - x.sorted = false; |
31 | | - x.Insert(new Node<Agent>("x", new Inc())); o( x.count, 2); |
| 30 | + var z = new NodeSet<T>(new T(), null); |
| 31 | + z.sorted = false; |
| 32 | + z.Insert(new Node<T>("x", new T())); o( z.count, 2); |
32 | 33 | } |
33 | 34 |
|
34 | | - [Test] public void InsertAndSort() |
35 | | - { x.Insert(new Node<Agent>("x", new Inc())); o( x.count, 2); } |
| 35 | + [Test] public void InsertAndSort(){ |
| 36 | + var z = new NodeSet<T>(new T(), null); |
| 37 | + z.Insert(new Node<T>("x", new T())); o( z.count, 2); } |
36 | 38 |
|
37 | 39 | [Test] public void Pop(){ |
38 | 40 | var z = x.Pop(); o( x.count, 0 ); o( z.state is Idler ); |
39 | 41 | o( z.action, INIT); |
40 | 42 | } |
41 | 43 |
|
| 44 | + class T{ |
| 45 | + int x = 0; public T() {} public T(int x){ this.x = x; } |
| 46 | + } |
| 47 | + |
42 | 48 | }} |
0 commit comments