MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / pathArrayContainsPath

Function pathArrayContainsPath

tests/unit/test_all_paths.c:58–76  ·  view source on GitHub ↗

This function tests for membership of a path, inside an array of multiple paths.

Source from the content-addressed store, hash-verified

56
57// This function tests for membership of a path, inside an array of multiple paths.
58bool 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
78void setup() {
79 // Use the malloc family for allocations

Callers 1

Calls 1

Path_NodeCountFunction · 0.85

Tested by

no test coverage detected