Skip to content

Commit 16e7eba

Browse files
committed
fix test messages,C++ comment style, and edited contributor list
1 parent 7f6b650 commit 16e7eba

4 files changed

Lines changed: 15 additions & 22 deletions

File tree

doc/src/pgRouting-introduction.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,8 @@ This Release Contributors
6666
Individuals in this release v4.0.0 (in alphabetical order)
6767
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6868

69-
Bipasha Gayary,
70-
Fan Wu,
7169
Mohit Rawat,
7270
Regina Obe,
73-
Saloni kumari,
7471
Vicky Vergara
7572

7673

pgtap/withPoints/withPoints/edge_cases/issue_2966.pg

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ $BODY$
3434
BEGIN
3535

3636
IF NOT min_version('4.1.0') THEN
37-
RETURN QUERY SELECT skip(1, 'pgr_withPoints: Issue 2966 test requires 4.1.0+');
37+
RETURN QUERY SELECT skip(1, 'pgr_withPoints: Fix implemented on 4.1.0');
3838
RETURN;
3939
END IF;
4040

@@ -45,48 +45,44 @@ BEGIN
4545
(102::BIGINT, 1002::BIGINT, 1003::BIGINT, 100::FLOAT, 100::FLOAT)
4646
) AS t(id, source, target, cost, reverse_cost);
4747

48-
-- Test 1: fraction = 0.99 should work correctly (baseline)
4948
RETURN QUERY SELECT set_eq(
5049
$$SELECT round(agg_cost::numeric, 2)::TEXT FROM pgr_withPoints(
5150
'SELECT * FROM test_edges',
5251
'SELECT * FROM (VALUES (1, 100, 0.5), (2, 101, 0.99)) AS t(pid, edge_id, fraction)',
5352
-1, -2
5453
) WHERE edge < 0$$,
5554
ARRAY['16.88']::TEXT[],
56-
'Issue 2966: fraction=0.99 should route correctly (baseline test)'
55+
'pgr_withPoints: fraction=0.99 baseline test'
5756
);
5857

59-
-- Test 2: fraction = 1 should ALSO work correctly (regression for issue 2966, which previously returned 105 instead of 17)
6058
RETURN QUERY SELECT set_eq(
6159
$$SELECT agg_cost::TEXT FROM pgr_withPoints(
6260
'SELECT * FROM test_edges',
6361
'SELECT * FROM (VALUES (1, 100, 0.5), (2, 101, 1)) AS t(pid, edge_id, fraction)',
6462
-1, -2
6563
) WHERE edge < 0$$,
6664
ARRAY['17']::TEXT[],
67-
'Issue 2966: fraction=1 should route via cheaper edge 101 (cost 17, not 105)'
65+
'pgr_withPoints: expected cost is 17'
6866
);
6967

70-
-- Test 3: Verify the path goes through edge 101, not edge 102
7168
RETURN QUERY SELECT set_eq(
7269
$$SELECT edge::TEXT FROM pgr_withPoints(
7370
'SELECT * FROM test_edges',
7471
'SELECT * FROM (VALUES (1, 100, 0.5), (2, 101, 1)) AS t(pid, edge_id, fraction)',
7572
-1, -2
7673
) WHERE edge > 0$$,
7774
ARRAY['100', '101']::TEXT[],
78-
'Issue 2966: Path should use edges 100 and 101 (not 102)'
75+
'pgr_withPoints: Path should use edges 100 and 101'
7976
);
8077

81-
-- Test 4: fraction = 0 case (control test)
8278
RETURN QUERY SELECT set_eq(
8379
$$SELECT agg_cost::TEXT FROM pgr_withPoints(
8480
'SELECT * FROM test_edges',
8581
'SELECT * FROM (VALUES (1, 100, 0.5), (2, 101, 0)) AS t(pid, edge_id, fraction)',
8682
-1, -2
8783
) WHERE edge < 0$$,
8884
ARRAY['5']::TEXT[],
89-
'Control test: fraction=0 should work (cost = 5 to reach start of edge 101)'
85+
'pgr_withPoints: fraction=0 control test'
9086
);
9187

9288
DROP TABLE test_edges;

pgtap/withPoints/withPointsVia/edge_cases/issue_2966.pg

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ $BODY$
3434
BEGIN
3535

3636
IF NOT min_version('4.1.0') THEN
37-
RETURN QUERY SELECT skip(1, 'pgr_withPointsVia: Issue 2966 test requires 4.1.0+');
37+
RETURN QUERY SELECT skip(1, 'pgr_withPointsVia: Fix implemented on 4.1.0');
3838
RETURN;
3939
END IF;
4040

@@ -45,7 +45,6 @@ BEGIN
4545
(102::BIGINT, 1002::BIGINT, 1003::BIGINT, 100::FLOAT, 100::FLOAT)
4646
) AS t(id, source, target, cost, reverse_cost);
4747

48-
-- Test 1: fraction = 1 should work correctly
4948
RETURN QUERY SELECT set_eq(
5049
$$SELECT agg_cost::TEXT FROM pgr_withPointsVia(
5150
'SELECT * FROM test_edges',
@@ -54,10 +53,9 @@ BEGIN
5453
'b'
5554
) WHERE edge < 0$$,
5655
ARRAY['17']::TEXT[],
57-
'Issue 2966 (Via): fraction=1 should route correctly (cost 17, not 105)'
56+
'pgr_withPointsVia: expected cost is 17'
5857
);
5958

60-
-- Test 2: Verify the path uses the correct edges
6159
RETURN QUERY SELECT set_eq(
6260
$$SELECT edge::TEXT FROM pgr_withPointsVia(
6361
'SELECT * FROM test_edges',
@@ -66,7 +64,7 @@ BEGIN
6664
'b'
6765
) WHERE edge > 0$$,
6866
ARRAY['100', '101']::TEXT[],
69-
'Issue 2966 (Via): Path should use edges 100 and 101'
67+
'pgr_withPointsVia: Path should use edges 100 and 101'
7068
);
7169

7270
DROP TABLE test_edges;

src/withPoints/withPoints.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,14 @@ Pg_points_graph::create_new_edges() {
397397
if (point.fraction == 1) {
398398
log << "point's vertex_id = target" << edge.target << "\n";
399399
point.vertex_id = -point.pid;
400-
// Zero-cost edge connecting target node to point (they're at same location)
400+
/* Zero-cost edge connecting target node to point (they're at same location) */
401401
Edge_t zero_edge = {edge.id, edge.target, -point.pid, 0, 0};
402402
m_new_edges.push_back(zero_edge);
403403

404-
// Also create edge from previous target to this point
405-
// This allows Dijkstra to find the direct path through this edge
404+
/*
405+
* Also create edge from previous target to this point
406+
* This allows Dijkstra to find the direct path through this edge
407+
*/
406408
double delta = point.fraction - prev_fraction;
407409
double rdelta = point.fraction - prev_rfraction;
408410
if (delta > 0) {
@@ -412,7 +414,7 @@ Pg_points_graph::create_new_edges() {
412414
m_new_edges.push_back(cost_edge);
413415
last_cost = cost_to_point;
414416
}
415-
// Update forward tracking variables
417+
/* Update forward tracking variables */
416418
prev_target = point.vertex_id;
417419
prev_fraction = point.fraction;
418420
agg_cost += last_cost;
@@ -424,7 +426,7 @@ Pg_points_graph::create_new_edges() {
424426
m_new_edges.push_back(rcost_edge);
425427
last_rcost = rcost_to_point;
426428
}
427-
// Update reverse tracking variables
429+
/* Update reverse tracking variables */
428430
prev_rtarget = point.vertex_id;
429431
prev_rfraction = point.fraction;
430432
agg_rcost += last_rcost;

0 commit comments

Comments
 (0)