Skip to content

Commit

Permalink
Add tests, seems like something is broken with Memgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
gitbuda committed Aug 9, 2024
1 parent 3de6fa3 commit 1ae833a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,17 @@ void PrintValue(std::ostream &os, const mg_duration *duration) {
os << "S";
}

// TODO(gitbuda): Align with whatever is Memgraph outputting.
void PrintValue(std::ostream &os, const mg_point_2d *value) {
os << "SRID: " << mg_point_2d_srid(value) << " X: " << mg_point_2d_x(value) << " Y: " << mg_point_2d_y(value);
os << "POINT({ x:" << mg_point_2d_x(value) << ","
<< " y:" << mg_point_2d_y(value) << ","
<< " srid:" << mg_point_2d_srid(value) << " })";
}

void PrintValue(std::ostream &os, const mg_point_3d *value) {
os << "SRID: " << mg_point_3d_srid(value) << " X: " << mg_point_3d_x(value) << " Y: " << mg_point_3d_y(value) << " Z: " << mg_point_3d_z(value);
os << "POINT({ x:" << mg_point_3d_x(value) << ","
<< " y:" << mg_point_3d_y(value) << ","
<< " z:" << mg_point_3d_z(value) << ","
<< " srid:" << mg_point_3d_srid(value) << " })";
}

void PrintValue(std::ostream &os, const mg_value *value) {
Expand Down
4 changes: 4 additions & 0 deletions tests/input_output/input/spatial.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RETURN point({x:0, y:1}) AS point;
RETURN point({latitude:0, longitude:1}) AS point;
RETURN point({x:0, y:1, z:2}) AS point;
RETURN point({latitude:0, longitude:1, height:2}) AS point;
8 changes: 8 additions & 0 deletions tests/input_output/output_csv/spatial.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"point"
"POINT({ x:0, y:1, srid:7203 })"
"point"
"POINT({ x:1, y:0, srid:4326 })"
"point"
"POINT({ x:0, y:1, z:2, srid:9757 })"
"point"
"POINT({ x:1, y:0, z:2, srid:4979 })"
20 changes: 20 additions & 0 deletions tests/input_output/output_tabular/spatial.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
+--------------------------------+
| point |
+--------------------------------+
| POINT({ x:0, y:1, srid:7203 }) |
+--------------------------------+
+--------------------------------+
| point |
+--------------------------------+
| POINT({ x:1, y:0, srid:4326 }) |
+--------------------------------+
+-------------------------------------+
| point |
+-------------------------------------+
| POINT({ x:0, y:1, z:2, srid:9757 }) |
+-------------------------------------+
+-------------------------------------+
| point |
+-------------------------------------+
| POINT({ x:1, y:0, z:2, srid:4979 }) |
+-------------------------------------+

0 comments on commit 1ae833a

Please sign in to comment.