Skip to content

Commit 64bba51

Browse files
committed
[spannTree] fix failing tests
1 parent b754efc commit 64bba51

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/spanningTree/kruskal.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ process(
6868
return;
6969
}
7070

71+
/* checks previously done on sql now done here */
72+
if (strcmp(fn_suffix, "DD") == 0 && distance < 0) {
73+
throw_error("Negative value found on 'distance'", "Must be positive");
74+
} else if ((strcmp(fn_suffix, "BFS") == 0 || strcmp(fn_suffix, "DFS") == 0) && max_depth < 0) {
75+
throw_error("Negative value found on 'max_depth'", "Must be positive");
76+
}
77+
7178
clock_t start_t = clock();
7279
pgr_do_kruskal(
7380
edges_sql,

src/spanningTree/prim.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ process(
6363
return;
6464
}
6565

66+
if (strcmp(fn_suffix, "DD") == 0 && distance < 0) {
67+
throw_error("Negative value found on 'distance'", "Must be positive");
68+
} else if ((strcmp(fn_suffix, "BFS") == 0 || strcmp(fn_suffix, "DFS") == 0) && max_depth < 0) {
69+
throw_error("Negative value found on 'max_depth'", "Must be positive");
70+
}
71+
6672
clock_t start_t = clock();
6773
pgr_do_prim(
6874
edges_sql,

0 commit comments

Comments
 (0)