()
| 94 | } |
| 95 | |
| 96 | public void testOneMapTypeNode() { |
| 97 | int NROF = 10; |
| 98 | setupMapData("1",null,null); |
| 99 | n1.addType(1); |
| 100 | |
| 101 | mbm.getInitialLocation(); |
| 102 | Path p = mbm.getPath(); |
| 103 | for (int i=0; i<NROF; i++) { |
| 104 | Coord next = p.getNextWaypoint(); |
| 105 | // only allowed location is c1 |
| 106 | assertEquals(c1, next); |
| 107 | } |
| 108 | |
| 109 | // add n2 to allowed nodes |
| 110 | n2.addType(1); |
| 111 | p = mbm.getPath(); |
| 112 | List<Coord> coords = p.getCoords(); |
| 113 | // should move between n1 and n2 |
| 114 | for (int i=0; i<coords.size()-1; i+= 2) { |
| 115 | assertEquals(c1, coords.get(i)); |
| 116 | assertEquals(c2, coords.get(i+1)); |
| 117 | } |
| 118 | |
| 119 | n6.addType(1); |
| 120 | p = mbm.getPath(); |
| 121 | coords = p.getCoords(); |
| 122 | |
| 123 | assertEquals(c2, coords.get(0)); // starts from n2 |
| 124 | |
| 125 | // should move route n1-n2-n6-n2-n1-n2 ... |
| 126 | for (int i=1; i<coords.size()-4; i+= 4) { |
| 127 | assertEquals(c1, coords.get(i)); |
| 128 | assertEquals(c2, coords.get(i+1)); |
| 129 | assertEquals(c6, coords.get(i+2)); |
| 130 | assertEquals(c2, coords.get(i+3)); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | public void testManyMapTypeNodes() { |
| 135 | setupMapData("1,2",null,null); |
nothing calls this directly
no test coverage detected