OmniSciDB  04ee39c94c
anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp} Namespace Reference

Functions

void check_geo_import ()
 
void check_geo_gdal_point_import ()
 
void check_geo_gdal_mpoly_import ()
 
void check_geo_num_rows (const std::string &project_columns, const size_t num_expected_rows)
 
void check_geo_gdal_point_tv_import ()
 
void check_geo_gdal_mpoly_tv_import ()
 

Variables

const char * create_table_geo
 

Function Documentation

◆ check_geo_gdal_mpoly_import()

void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_gdal_mpoly_import ( )

Definition at line 1141 of file ImportTest.cpp.

References CHECK_EQ, and anonymous_namespace{ImportTest.cpp}::run_query().

Referenced by anonymous_namespace{ImportTest.cpp}::TEST_F().

1141  {
1142  auto rows = run_query("SELECT omnisci_geo, trip FROM geospatial WHERE trip = 1.0");
1143  auto crt_row = rows->getNextRow(true, true);
1144  CHECK_EQ(size_t(2), crt_row.size());
1145  const auto mpoly = boost::get<std::string>(v<NullableString>(crt_row[0]));
1146  ASSERT_TRUE(Geo_namespace::GeoMultiPolygon("MULTIPOLYGON (((0 0,2 0,0 2,0 0)))") ==
1148  const auto trip_distance = v<double>(crt_row[1]);
1149  ASSERT_NEAR(1.0, trip_distance, 1e-7);
1150 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< ResultSet > run_query(const string &query_str)
Definition: ImportTest.cpp:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_geo_gdal_mpoly_tv_import()

void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_gdal_mpoly_tv_import ( )

Definition at line 1167 of file ImportTest.cpp.

References TestHelpers::compare_geo_target(), ResultSet::GeoTargetValue, and anonymous_namespace{ImportTest.cpp}::run_query().

Referenced by anonymous_namespace{ImportTest.cpp}::TEST_F().

1167  {
1168  auto rows = run_query("SELECT omnisci_geo, trip FROM geospatial WHERE trip = 1.0");
1169  rows->setGeoReturnType(ResultSet::GeoReturnType::GeoTargetValue);
1170  auto crt_row = rows->getNextRow(true, true);
1171  compare_geo_target(crt_row[0],
1172  GeoMultiPolyTargetValue({0.0, 0.0, 2.0, 0.0, 0.0, 2.0}, {3}, {1}),
1173  1e-7);
1174  const auto trip_distance = v<double>(crt_row[1]);
1175  ASSERT_NEAR(1.0, trip_distance, 1e-7);
1176 }
void compare_geo_target(const TargetValue &r, const T &geo_truth_target, const double tol=-1.)
Definition: TestHelpers.h:127
std::shared_ptr< ResultSet > run_query(const string &query_str)
Definition: ImportTest.cpp:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_geo_gdal_point_import()

void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_gdal_point_import ( )

Definition at line 1131 of file ImportTest.cpp.

References CHECK_EQ, and anonymous_namespace{ImportTest.cpp}::run_query().

Referenced by anonymous_namespace{ImportTest.cpp}::TEST_F().

1131  {
1132  auto rows = run_query("SELECT omnisci_geo, trip FROM geospatial WHERE trip = 1.0");
1133  auto crt_row = rows->getNextRow(true, true);
1134  CHECK_EQ(size_t(2), crt_row.size());
1135  const auto point = boost::get<std::string>(v<NullableString>(crt_row[0]));
1136  ASSERT_TRUE(Geo_namespace::GeoPoint("POINT (1 1)") == Geo_namespace::GeoPoint(point));
1137  const auto trip_distance = v<double>(crt_row[1]);
1138  ASSERT_NEAR(1.0, trip_distance, 1e-7);
1139 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< ResultSet > run_query(const string &query_str)
Definition: ImportTest.cpp:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_geo_gdal_point_tv_import()

void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_gdal_point_tv_import ( )

Definition at line 1158 of file ImportTest.cpp.

References TestHelpers::compare_geo_target(), ResultSet::GeoTargetValue, and anonymous_namespace{ImportTest.cpp}::run_query().

Referenced by anonymous_namespace{ImportTest.cpp}::TEST_F().

1158  {
1159  auto rows = run_query("SELECT omnisci_geo, trip FROM geospatial WHERE trip = 1.0");
1160  rows->setGeoReturnType(ResultSet::GeoReturnType::GeoTargetValue);
1161  auto crt_row = rows->getNextRow(true, true);
1162  compare_geo_target(crt_row[0], GeoPointTargetValue({1.0, 1.0}), 1e-7);
1163  const auto trip_distance = v<double>(crt_row[1]);
1164  ASSERT_NEAR(1.0, trip_distance, 1e-7);
1165 }
void compare_geo_target(const TargetValue &r, const T &geo_truth_target, const double tol=-1.)
Definition: TestHelpers.h:127
std::shared_ptr< ResultSet > run_query(const string &query_str)
Definition: ImportTest.cpp:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_geo_import()

void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_import ( )

Definition at line 1102 of file ImportTest.cpp.

References CHECK_EQ, and anonymous_namespace{ImportTest.cpp}::run_query().

Referenced by anonymous_namespace{ImportTest.cpp}::TEST_F().

1102  {
1103  auto rows = run_query(R"(
1104  SELECT p1, l, poly, mpoly, p2, p3, p4, trip_distance
1105  FROM geospatial
1106  WHERE trip_distance = 1.0;
1107  )");
1108  auto crt_row = rows->getNextRow(true, true);
1109  CHECK_EQ(size_t(8), crt_row.size());
1110  const auto p1 = boost::get<std::string>(v<NullableString>(crt_row[0]));
1111  ASSERT_TRUE(Geo_namespace::GeoPoint("POINT (1 1)") == Geo_namespace::GeoPoint(p1));
1112  const auto linestring = boost::get<std::string>(v<NullableString>(crt_row[1]));
1113  ASSERT_TRUE(Geo_namespace::GeoLineString("LINESTRING (1 0,2 2,3 3)") ==
1114  Geo_namespace::GeoLineString(linestring));
1115  const auto poly = boost::get<std::string>(v<NullableString>(crt_row[2]));
1116  ASSERT_TRUE(Geo_namespace::GeoPolygon("POLYGON ((0 0,2 0,0 2,0 0))") ==
1118  const auto mpoly = boost::get<std::string>(v<NullableString>(crt_row[3]));
1119  ASSERT_TRUE(Geo_namespace::GeoMultiPolygon("MULTIPOLYGON (((0 0,2 0,0 2,0 0)))") ==
1121  const auto p2 = boost::get<std::string>(v<NullableString>(crt_row[4]));
1122  ASSERT_TRUE(Geo_namespace::GeoPoint("POINT (1 1)") == Geo_namespace::GeoPoint(p2));
1123  const auto p3 = boost::get<std::string>(v<NullableString>(crt_row[5]));
1124  ASSERT_TRUE(Geo_namespace::GeoPoint("POINT (1 1)") == Geo_namespace::GeoPoint(p3));
1125  const auto p4 = boost::get<std::string>(v<NullableString>(crt_row[6]));
1126  ASSERT_TRUE(Geo_namespace::GeoPoint("POINT (1 1)") == Geo_namespace::GeoPoint(p4));
1127  const auto trip_distance = v<double>(crt_row[7]);
1128  ASSERT_NEAR(1.0, trip_distance, 1e-7);
1129 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< ResultSet > run_query(const string &query_str)
Definition: ImportTest.cpp:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_geo_num_rows()

void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_num_rows ( const std::string &  project_columns,
const size_t  num_expected_rows 
)

Definition at line 1152 of file ImportTest.cpp.

References anonymous_namespace{ImportTest.cpp}::run_query().

Referenced by anonymous_namespace{ImportTest.cpp}::TEST_F().

1153  {
1154  auto rows = run_query("SELECT " + project_columns + " FROM geospatial");
1155  ASSERT_TRUE(rows->entryCount() == num_expected_rows);
1156 }
std::shared_ptr< ResultSet > run_query(const string &query_str)
Definition: ImportTest.cpp:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ create_table_geo

const char* anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::create_table_geo
Initial value:
= R"(
CREATE TABLE geospatial (
p1 POINT,
l LINESTRING,
poly POLYGON,
mpoly MULTIPOLYGON,
p2 POINT,
p3 POINT,
p4 POINT,
trip_distance DOUBLE
) WITH (FRAGMENT_SIZE=65000000);
)"

Definition at line 1089 of file ImportTest.cpp.

Referenced by anonymous_namespace{ImportTest.cpp}::GeoImportTest::SetUp().