Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of assert_columns* APIs. #433

Merged
merged 1 commit into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cpp/tests/io/shp/polygon_shapefile_reader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

using namespace cudf::test;

constexpr cudf::test::debug_output_level verbosity{cudf::test::debug_output_level::ALL_ERRORS};

std::string get_shapefile_path(std::string filename)
{
const char* cuspatial_home = std::getenv("CUSPATIAL_HOME");
Expand All @@ -51,10 +53,10 @@ void test(std::string const& shapefile_name,
auto expected_poly_point_xs = wrapper<double>(xs.begin(), xs.end());
auto expected_poly_point_ys = wrapper<double>(ys.begin(), ys.end());

expect_columns_equivalent(expected_poly_offsets, polygon_columns.at(0)->view(), true);
expect_columns_equivalent(expected_ring_offsets, polygon_columns.at(1)->view(), true);
expect_columns_equivalent(expected_poly_point_xs, polygon_columns.at(2)->view(), true);
expect_columns_equivalent(expected_poly_point_ys, polygon_columns.at(3)->view(), true);
expect_columns_equivalent(expected_poly_offsets, polygon_columns.at(0)->view(), verbosity);
expect_columns_equivalent(expected_ring_offsets, polygon_columns.at(1)->view(), verbosity);
expect_columns_equivalent(expected_poly_point_xs, polygon_columns.at(2)->view(), verbosity);
expect_columns_equivalent(expected_poly_point_ys, polygon_columns.at(3)->view(), verbosity);
}

struct PolygonShapefileReaderTest : public BaseFixture {
Expand Down
8 changes: 5 additions & 3 deletions cpp/tests/join/point_in_polygon_test_large.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
* and popc. Thrust primitives to divide quadrants into sub-blocks are also tested.
*/

constexpr cudf::test::debug_output_level verbosity{cudf::test::debug_output_level::ALL_ERRORS};

template <typename T>
struct PIPRefineTestLarge : public cudf::test::BaseFixture {
};
Expand Down Expand Up @@ -271,17 +273,17 @@ TYPED_TEST(PIPRefineTestLarge, TestLarge)
fixed_width_column_wrapper<uint32_t>(expected_poly_indices.begin(),
expected_poly_indices.end()),
fixed_width_column_wrapper<uint32_t>(actual_poly_indices.begin(), actual_poly_indices.end()),
true);
verbosity);

cudf::test::expect_columns_equal(
fixed_width_column_wrapper<uint32_t>(expected_point_indices.begin(),
expected_point_indices.end()),
fixed_width_column_wrapper<uint32_t>(actual_point_indices.begin(), actual_point_indices.end()),
true);
verbosity);

cudf::test::expect_columns_equal(
fixed_width_column_wrapper<uint32_t>(expected_point_lengths.begin(),
expected_point_lengths.end()),
fixed_width_column_wrapper<uint32_t>(actual_point_lengths.begin(), actual_point_lengths.end()),
true);
verbosity);
}
26 changes: 14 additions & 12 deletions cpp/tests/spatial/coordinate_transform_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

using namespace cudf::test;

constexpr cudf::test::debug_output_level verbosity{cudf::test::debug_output_level::ALL_ERRORS};

template <typename T>
struct LonLatToCartesianTest : public BaseFixture {
};
Expand All @@ -48,8 +50,8 @@ TYPED_TEST(LonLatToCartesianTest, Single)
auto expected_lon = fixed_width_column_wrapper<T>({-0.01126195531216838});
auto expected_lat = fixed_width_column_wrapper<T>({-0.21375777777718794});

expect_columns_equivalent(expected_lon, res_pair.first->view(), true);
expect_columns_equivalent(expected_lat, res_pair.second->view(), true);
expect_columns_equivalent(expected_lon, res_pair.first->view(), verbosity);
expect_columns_equivalent(expected_lat, res_pair.second->view(), verbosity);
}

TYPED_TEST(LonLatToCartesianTest, Extremes)
Expand All @@ -66,8 +68,8 @@ TYPED_TEST(LonLatToCartesianTest, Extremes)
fixed_width_column_wrapper<T>({0.0, 0.0, 20000.0, -20000.0, -5000.0, 14142.13562373095192015});
auto expected_lat = fixed_width_column_wrapper<T>({10000.0, -10000.0, 0.0, 0.0, 0.0, 10000.0});

expect_columns_equivalent(expected_lon, res_pair.first->view(), true);
expect_columns_equivalent(expected_lat, res_pair.second->view(), true);
expect_columns_equivalent(expected_lon, res_pair.first->view(), verbosity);
expect_columns_equivalent(expected_lat, res_pair.second->view(), verbosity);
}

TYPED_TEST(LonLatToCartesianTest, Multiple)
Expand All @@ -85,8 +87,8 @@ TYPED_TEST(LonLatToCartesianTest, Multiple)
auto expected_lat = fixed_width_column_wrapper<T>(
{-0.21375777777718794, 0.05002000000015667, 0.06113111111163663, -0.20586888888847929});

expect_columns_equivalent(expected_lon, res_pair.first->view(), true);
expect_columns_equivalent(expected_lat, res_pair.second->view(), true);
expect_columns_equivalent(expected_lon, res_pair.first->view(), verbosity);
expect_columns_equivalent(expected_lat, res_pair.second->view(), verbosity);
}

TYPED_TEST(LonLatToCartesianTest, Empty)
Expand All @@ -102,8 +104,8 @@ TYPED_TEST(LonLatToCartesianTest, Empty)
auto expected_lon = fixed_width_column_wrapper<T>({});
auto expected_lat = fixed_width_column_wrapper<T>({});

expect_columns_equivalent(expected_lon, res_pair.first->view(), true);
expect_columns_equivalent(expected_lat, res_pair.second->view(), true);
expect_columns_equivalent(expected_lon, res_pair.first->view(), verbosity);
expect_columns_equivalent(expected_lat, res_pair.second->view(), verbosity);
}

TYPED_TEST(LonLatToCartesianTest, NullableNoNulls)
Expand All @@ -119,8 +121,8 @@ TYPED_TEST(LonLatToCartesianTest, NullableNoNulls)
auto expected_lon = fixed_width_column_wrapper<T>({-0.01126195531216838});
auto expected_lat = fixed_width_column_wrapper<T>({-0.21375777777718794});

expect_columns_equivalent(expected_lon, res_pair.first->view(), true);
expect_columns_equivalent(expected_lat, res_pair.second->view(), true);
expect_columns_equivalent(expected_lon, res_pair.first->view(), verbosity);
expect_columns_equivalent(expected_lat, res_pair.second->view(), verbosity);
}

TYPED_TEST(LonLatToCartesianTest, NullabilityMixedNoNulls)
Expand All @@ -136,8 +138,8 @@ TYPED_TEST(LonLatToCartesianTest, NullabilityMixedNoNulls)
auto expected_lon = fixed_width_column_wrapper<T>({-0.01126195531216838});
auto expected_lat = fixed_width_column_wrapper<T>({-0.21375777777718794});

expect_columns_equivalent(expected_lon, res_pair.first->view(), true);
expect_columns_equivalent(expected_lat, res_pair.second->view(), true);
expect_columns_equivalent(expected_lon, res_pair.first->view(), verbosity);
expect_columns_equivalent(expected_lat, res_pair.second->view(), verbosity);
}

TYPED_TEST(LonLatToCartesianTest, NullableWithNulls)
Expand Down
14 changes: 8 additions & 6 deletions cpp/tests/spatial/hausdorff_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
using namespace cudf;
using namespace test;

constexpr cudf::test::debug_output_level verbosity{cudf::test::debug_output_level::ALL_ERRORS};

template <typename T, uint32_t num_spaces, uint32_t elements_per_space>
void generic_hausdorff_test(rmm::mr::device_memory_resource* mr)
{
Expand Down Expand Up @@ -74,7 +76,7 @@ TYPED_TEST(HausdorffTest, Empty)

auto actual = cuspatial::directed_hausdorff_distance(x, y, space_offsets, this->mr());

expect_columns_equivalent(expected, actual->view(), true);
expect_columns_equivalent(expected, actual->view(), verbosity);
}

TYPED_TEST(HausdorffTest, Simple)
Expand All @@ -89,7 +91,7 @@ TYPED_TEST(HausdorffTest, Simple)

auto actual = cuspatial::directed_hausdorff_distance(x, y, space_offsets, this->mr());

expect_columns_equivalent(expected, actual->view(), true);
expect_columns_equivalent(expected, actual->view(), verbosity);
}

TYPED_TEST(HausdorffTest, SingleTrajectorySinglePoint)
Expand All @@ -104,7 +106,7 @@ TYPED_TEST(HausdorffTest, SingleTrajectorySinglePoint)

auto actual = cuspatial::directed_hausdorff_distance(x, y, space_offsets, this->mr());

expect_columns_equivalent(expected, actual->view(), true);
expect_columns_equivalent(expected, actual->view(), verbosity);
}

TYPED_TEST(HausdorffTest, TwoShortSpaces)
Expand All @@ -119,7 +121,7 @@ TYPED_TEST(HausdorffTest, TwoShortSpaces)

auto actual = cuspatial::directed_hausdorff_distance(x, y, space_offsets, this->mr());

expect_columns_equivalent(expected, actual->view(), true);
expect_columns_equivalent(expected, actual->view(), verbosity);
}

TYPED_TEST(HausdorffTest, TwoShortSpaces2)
Expand All @@ -142,7 +144,7 @@ TYPED_TEST(HausdorffTest, TwoShortSpaces2)

auto actual = cuspatial::directed_hausdorff_distance(x, y, space_offsets, this->mr());

expect_columns_equivalent(expected, actual->view(), true);
expect_columns_equivalent(expected, actual->view(), verbosity);
}

TYPED_TEST(HausdorffTest, 500Spaces100Points)
Expand Down Expand Up @@ -208,5 +210,5 @@ TYPED_TEST(HausdorffTest, ThreeSpacesLengths543)

auto actual = cuspatial::directed_hausdorff_distance(x, y, space_offsets, this->mr());

expect_columns_equivalent(expected, actual->view(), true);
expect_columns_equivalent(expected, actual->view(), verbosity);
}
8 changes: 5 additions & 3 deletions cpp/tests/spatial/haversine_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

using namespace cudf::test;

constexpr cudf::test::debug_output_level verbosity{cudf::test::debug_output_level::ALL_ERRORS};

template <typename T>
struct HaversineTest : public BaseFixture {
};
Expand All @@ -50,7 +52,7 @@ TYPED_TEST(HaversineTest, Empty)

auto actual = cuspatial::haversine_distance(a_lon, a_lat, b_lon, b_lat);

expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

TYPED_TEST(HaversineTest, Zero)
Expand All @@ -66,7 +68,7 @@ TYPED_TEST(HaversineTest, Zero)

auto actual = cuspatial::haversine_distance(a_lon, a_lat, b_lon, b_lat);

expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

TYPED_TEST(HaversineTest, EquivalentPoints)
Expand All @@ -82,7 +84,7 @@ TYPED_TEST(HaversineTest, EquivalentPoints)

auto actual = cuspatial::haversine_distance(a_lon, a_lat, b_lon, b_lat);

expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

TYPED_TEST(HaversineTest, MismatchSize)
Expand Down
20 changes: 11 additions & 9 deletions cpp/tests/spatial/point_in_polygon_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ struct PointInPolygonTest : public BaseFixture {
using TestTypes = FloatingPointTypes;
TYPED_TEST_CASE(PointInPolygonTest, TestTypes);

constexpr cudf::test::debug_output_level verbosity{cudf::test::debug_output_level::ALL_ERRORS};

TYPED_TEST(PointInPolygonTest, Empty)
{
using T = TypeParam;
Expand All @@ -54,7 +56,7 @@ TYPED_TEST(PointInPolygonTest, Empty)
auto actual = cuspatial::point_in_polygon(
test_point_xs, test_point_ys, poly_offsets, poly_ring_offsets, poly_point_xs, poly_point_ys);

expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

TYPED_TEST(PointInPolygonTest, OnePolygonOneRing)
Expand All @@ -73,7 +75,7 @@ TYPED_TEST(PointInPolygonTest, OnePolygonOneRing)
auto actual = cuspatial::point_in_polygon(
test_point_xs, test_point_ys, poly_offsets, poly_ring_offsets, poly_point_xs, poly_point_ys);

expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

TYPED_TEST(PointInPolygonTest, TwoPolygonsOneRingEach)
Expand All @@ -92,7 +94,7 @@ TYPED_TEST(PointInPolygonTest, TwoPolygonsOneRingEach)
auto actual = cuspatial::point_in_polygon(
test_point_xs, test_point_ys, poly_offsets, poly_ring_offsets, poly_point_xs, poly_point_ys);

expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

TYPED_TEST(PointInPolygonTest, OnePolygonTwoRings)
Expand All @@ -113,7 +115,7 @@ TYPED_TEST(PointInPolygonTest, OnePolygonTwoRings)
auto actual = cuspatial::point_in_polygon(
test_point_xs, test_point_ys, poly_offsets, poly_ring_offsets, poly_point_xs, poly_point_ys);

expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

TYPED_TEST(PointInPolygonTest, EdgesOfSquare)
Expand Down Expand Up @@ -141,7 +143,7 @@ TYPED_TEST(PointInPolygonTest, EdgesOfSquare)
auto actual = cuspatial::point_in_polygon(
test_point_xs, test_point_ys, poly_offsets, poly_ring_offsets, poly_point_xs, poly_point_ys);

expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

TYPED_TEST(PointInPolygonTest, CornersOfSquare)
Expand Down Expand Up @@ -169,7 +171,7 @@ TYPED_TEST(PointInPolygonTest, CornersOfSquare)
auto actual = cuspatial::point_in_polygon(
test_point_xs, test_point_ys, poly_offsets, poly_ring_offsets, poly_point_xs, poly_point_ys);

expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

TYPED_TEST(PointInPolygonTest, 31PolygonSupport)
Expand Down Expand Up @@ -214,7 +216,7 @@ TYPED_TEST(PointInPolygonTest, 31PolygonSupport)
auto actual = cuspatial::point_in_polygon(
test_point_xs, test_point_ys, poly_offsets, poly_ring_offsets, poly_point_xs, poly_point_ys);

expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

template <typename T>
Expand Down Expand Up @@ -364,7 +366,7 @@ TYPED_TEST(PointInPolygonTest, SelfClosingLoopLeftEdgeMissing)
auto expected = wrapper<int32_t>({0b0, 0b1, 0b0});
auto actual = cuspatial::point_in_polygon(
test_point_xs, test_point_ys, poly_offsets, poly_ring_offsets, poly_point_xs, poly_point_ys);
expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}

TYPED_TEST(PointInPolygonTest, SelfClosingLoopRightEdgeMissing)
Expand All @@ -380,5 +382,5 @@ TYPED_TEST(PointInPolygonTest, SelfClosingLoopRightEdgeMissing)
auto expected = wrapper<int32_t>({0b0, 0b1, 0b0});
auto actual = cuspatial::point_in_polygon(
test_point_xs, test_point_ys, poly_offsets, poly_ring_offsets, poly_point_xs, poly_point_ys);
expect_columns_equal(expected, actual->view(), true);
expect_columns_equal(expected, actual->view(), verbosity);
}
10 changes: 6 additions & 4 deletions cpp/tests/spatial_window/spatial_window_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

#include <type_traits>

constexpr cudf::test::debug_output_level verbosity{cudf::test::debug_output_level::ALL_ERRORS};

template <typename T>
struct SpatialWindowTest : public cudf::test::BaseFixture {
};
Expand All @@ -49,8 +51,8 @@ TYPED_TEST(SpatialWindowTest, SimpleTest)

auto result = cuspatial::points_in_spatial_window(1.5, 5.5, 1.5, 5.5, points_x, points_y);

cudf::test::expect_columns_equivalent(result->get_column(0), expected_points_x, true);
cudf::test::expect_columns_equivalent(result->get_column(1), expected_points_y, true);
cudf::test::expect_columns_equivalent(result->get_column(0), expected_points_x, verbosity);
cudf::test::expect_columns_equivalent(result->get_column(1), expected_points_y, verbosity);
}

// Test that windows with min/max reversed still work
Expand All @@ -68,8 +70,8 @@ TYPED_TEST(SpatialWindowTest, ReversedWindow)

auto result = cuspatial::points_in_spatial_window(5.5, 1.5, 5.5, 1.5, points_x, points_y);

cudf::test::expect_columns_equivalent(result->get_column(0), expected_points_x, true);
cudf::test::expect_columns_equivalent(result->get_column(1), expected_points_y, true);
cudf::test::expect_columns_equivalent(result->get_column(0), expected_points_x, verbosity);
cudf::test::expect_columns_equivalent(result->get_column(1), expected_points_y, verbosity);
}

struct SpatialWindowErrorTest : public cudf::test::BaseFixture {
Expand Down