This function tests for membership of a path, inside an array of multiple paths.
| 56 | |
| 57 | // This function tests for membership of a path, inside an array of multiple paths. |
| 58 | bool pathArrayContainsPath(NodeID **array, int arrayLen, Path *path) { |
| 59 | for(int i = 0; i < arrayLen; i++) { |
| 60 | NodeID *expectedPath = array[i]; |
| 61 | int expectedPathLen = expectedPath[0]; |
| 62 | if(expectedPathLen != Path_NodeCount(path)) { |
| 63 | continue; |
| 64 | } |
| 65 | bool arrayContainsPath = true; |
| 66 | for(int j = 1; j <= expectedPathLen; j++) { |
| 67 | Node n = path->nodes[j - 1]; |
| 68 | if(ENTITY_GET_ID(&n) != expectedPath[j]) { |
| 69 | arrayContainsPath = false; |
| 70 | break; |
| 71 | } |
| 72 | } |
| 73 | if(arrayContainsPath) return true; |
| 74 | } |
| 75 | return false; |
| 76 | } |
| 77 | |
| 78 | void setup() { |
| 79 | // Use the malloc family for allocations |
no test coverage detected