static inline void apply(std::string const& case_id,
                             std::string const& wkt1,
                             std::string const& wkt2,
                             std::string const& feature1,
                             std::string const& feature2,
                             features_type ftype,
                             Strategy const& strategy)
    {
        double const radius = strategy.radius();
        double expected_distance, expected_comparable_distance;

        if (ftype == pp)
        {
            expected_distance = distance_pp(feature1, feature2, radius);
            expected_comparable_distance
                = comparable_distance_pp(feature1, feature2);
        }
        else
        {
            expected_distance = distance_ps(feature1, feature2, radius);
            expected_comparable_distance
                = comparable_distance_ps(feature1, feature2);
        }

        apply(case_id, wkt1, wkt2,
              expected_distance, expected_comparable_distance,
              strategy);
    }
void test_distance_point_point(Strategy const& strategy,
                               bool is_comparable_strategy = false)
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
    std::cout << std::endl;
    std::cout << "point/point distance tests" << std::endl;
#endif
    typedef test_distance_of_geometries<point_type, point_type> tester;

    tester::apply("p-p-01",
                  "POINT(10 10)",
                  "POINT(0 0)",
                  (is_comparable_strategy
                   ? 0.0150768448035229
                   : (0.24619691677893202 * strategy.radius())),
                  0.0150768448035229,
                  strategy);
    tester::apply("p-p-02",
                  "POINT(10 10)",
                  "POINT(10 10)",
                  0,
                  strategy);

    // antipodal points
    tester::apply("p-p-03",
                  "POINT(0 10)",
                  "POINT(180 -10)",
                  (is_comparable_strategy
                   ? 1.0
                   : (180.0 * bg::math::d2r * strategy.radius())),
                  1.0,
                  strategy);
    tester::apply("p-p-04",
                  "POINT(0 0)",
                  "POINT(180 0)",
                  (is_comparable_strategy
                   ? 1.0
                   : (180.0 * bg::math::d2r * strategy.radius())),
                  1.0,
                  strategy);
}
void test_distance_point_box(Strategy const& strategy)
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
    std::cout << std::endl;
    std::cout << "point/box distance tests" << std::endl;
#endif
    typedef test_distances<point_type, box_type> tester;

    double const radius = strategy.radius();
    double const d2r = bg::math::d2r<double>();

    // Cases for relative location of a point wrt to a box
    //
    //           |         |
    //           |    3    |
    //           |         |
    //           +---------+
    //           |         |
    //       1   |    5    |   2
    //           |         |
    //           +---------+
    //           |         |
    //           |    4    |
    //           |         |
    //
    // and also the following cases
    //
    //           |         |
    //           A         B
    //           |         |
    //           +----C----+
    //           |         |
    //           D         E
    //           |         |
    //           +----F----+
    //           |         |
    //           G         H
    //           |         |
    //
    // and finally we have the corners
    //
    //           |         |
    //           |         |
    //           |         |
    //           a---------b
    //           |         |
    //           |         |
    //           |         |
    //           c---------d
    //           |         |
    //           |         |
    //           |         |
    //
    // for each relative position we also have to test the shifted point
    // (this is due to the fact that boxes have longitudes in the
    // range [-180, 540)

    std::string const box1 = "BOX(10 10,20 20)";

    // case 1
    tester::apply("pb1-1a", "POINT(5 25)", box1,
                  "POINT(5 25)", "POINT(10 20)", pp,
                  strategy);

    // case 1
    tester::apply("pb1-1b", "POINT(3 12)", box1,
                  "POINT(3 12)", "SEGMENT(10 10,10 20)", ps,
                  strategy);

    // case 1
    tester::apply("pb1-1c", "POINT(3 17)", box1,
                  "POINT(3 17)", "SEGMENT(10 10,10 20)", ps,
                  strategy);

    // case 1
    tester::apply("pb1-1d", "POINT(5 4)", box1,
                  "POINT(5 4)", "POINT(10 10)", pp,
                  strategy);

    // case 1
    tester::apply("pb1-1e", "POINT(-100 20)", box1,
                  "POINT(-100 20)", "POINT(10 20)", pp,
                  strategy);

    // case 1
    tester::apply("pb1-1g", "POINT(-100 10)", box1,
                  "POINT(-100 10)", "SEGMENT(10 10,10 20)", ps,
                  strategy);

    // case 2
    tester::apply("pb1-2a", "POINT(31 25)", box1,
                  "POINT(31 25)", "POINT(20 20)", pp,
                  strategy);

    // case 2
    tester::apply("pb1-2b", "POINT(23 17)", box1,
                  "POINT(23 17)", "SEGMENT(20 10,20 20)", ps,
                  strategy);

    // case 2
    tester::apply("pb1-2c", "POINT(29 3)", box1,
                  "POINT(29 3)", "POINT(20 10)", pp,
                  strategy);

    // case 2
    tester::apply("pb1-2d", "POINT(131 65)", box1,
                  "POINT(131 65)", "POINT(20 20)", pp,
                  strategy);

    // case 2
    tester::apply("pb1-2e", "POINT(110 10)", box1,
                  "POINT(110 10)", "SEGMENT(20 10,20 20)", ps,
                  strategy);

    // case 2
    tester::apply("pb1-2f", "POINT(150 20)", box1,
                  "POINT(150 20)", "POINT(20 20)", pp,
                  strategy);

    // case 3
    tester::apply("pb1-3a", "POINT(11 25)", box1,
                  5.0 * d2r * radius,
                  to_comparable(5.0 * d2r * radius, radius),
                  strategy);

    // case 3
    tester::apply("pb1-3b", "POINT(15 25)", box1,
                  5.0 * d2r * radius,
                  to_comparable(5.0 * d2r * radius, radius),
                  strategy);

    // case 3
    tester::apply("pb1-3c", "POINT(18 25)", box1,
                  5.0 * d2r * radius,
                  to_comparable(5.0 * d2r * radius, radius),
                  strategy);

    // case 4
    tester::apply("pb1-4a", "POINT(13 4)", box1,
                  6.0 * radius * d2r,
                  to_comparable(6.0 * radius * d2r, radius),
                  strategy);

    // case 4
    tester::apply("pb1-4b", "POINT(19 4)", box1,
                  6.0 * radius * d2r,
                  to_comparable(6.0 * radius * d2r, radius),
                  strategy);

    // case 5
    tester::apply("pb1-5", "POINT(15 14)", box1, 0, 0, strategy);

    // case A
    tester::apply("pb1-A", "POINT(10 28)", box1,
                  8.0 * d2r * radius,
                  to_comparable(8.0 * d2r * radius, radius),
                  strategy);

    // case B
    tester::apply("pb1-B", "POINT(20 28)", box1,
                  8.0 * d2r * radius,
                  to_comparable(8.0 * d2r * radius, radius),
                  strategy);

    // case C
    tester::apply("pb1-C", "POINT(14 20)", box1, 0, 0, strategy);

    // case D
    tester::apply("pb1-D", "POINT(10 17)", box1, 0, 0, strategy);

    // case E
    tester::apply("pb1-E", "POINT(20 11)", box1, 0, 0, strategy);

    // case F
    tester::apply("pb1-F", "POINT(19 10)", box1, 0, 0, strategy);

    // case G
    tester::apply("pb1-G", "POINT(10 -40)", box1,
                  50.0 * d2r * radius,
                  to_comparable(50.0 * d2r * radius, radius),
                  strategy);

    // case H
    tester::apply("pb1-H",
                  "POINT(20 -50)", box1,
                  60.0 * d2r * radius,
                  to_comparable(60.0 * d2r * radius, radius),
                  strategy);

    // case a
    tester::apply("pb1-a", "POINT(10 20)", box1, 0, 0, strategy);
    // case b
    tester::apply("pb1-b", "POINT(20 20)", box1, 0, 0, strategy);
    // case c
    tester::apply("pb1-c", "POINT(10 10)", box1, 0, 0, strategy);
    // case d
    tester::apply("pb1-d", "POINT(20 10)", box1, 0, 0, strategy);



    std::string const box2 = "BOX(170 -60,400 80)";

    // case 1 - point is closer to western meridian
    tester::apply("pb2-1a", "POINT(160 0)", box2,
                  "POINT(160 0)", "SEGMENT(170 -60,170 80)", ps,
                  strategy);

    // case 1 - point is closer to eastern meridian
    tester::apply("pb2-1b", "POINT(50 0)", box2,
                  "POINT(50 0)", "SEGMENT(40 -60,40 80)", ps,
                  strategy);

    // case 3 - equivalent point POINT(390 85) is above the box
    tester::apply("pb2-3", "POINT(30 85)", box2,
                  5.0 * d2r * radius,
                  to_comparable(5.0 * d2r * radius, radius),
                  strategy);

    // case 4 - equivalent point POINT(390 -75) is below the box
    tester::apply("pb2-4", "POINT(30 -75)", box2,
                  15.0 * d2r * radius,
                  to_comparable(15.0 * d2r * radius, radius),
                  strategy);

    // case 5 - equivalent point POINT(390 0) is inside box
    tester::apply("pb2-5", "POINT(30 0)", box2, 0, 0, strategy);


    std::string const box3 = "BOX(-150 -50,-40 70)";

    // case 1 - point is closer to western meridian
    tester::apply("pb3-1a", "POINT(-170 10)", box3,
                  "POINT(-170 10)", "SEGMENT(-150 -50,-150 70)", ps,
                  strategy);

    // case 2 - point is closer to eastern meridian
    tester::apply("pb3-2a", "POINT(5 10)", box3,
                  "POINT(5 10)", "SEGMENT(-40 -50,-40 70)", ps,
                  strategy);

    // case 2 - point is closer to western meridian
    tester::apply("pb3-2a", "POINT(160 10)", box3,
                  "POINT(160 10)", "SEGMENT(-150 -50,-150 70)", ps,
                  strategy);

    // case 2 - point is at equal distance from eastern and western meridian
    tester::apply("pb3-2c1", "POINT(85 20)", box3,
                  "POINT(85 20)", "SEGMENT(-150 -50,-150 70)", ps,
                  strategy);

    // case 2 - point is at equal distance from eastern and western meridian
    tester::apply("pb3-2c2", "POINT(85 20)", box3,
                  "POINT(85 20)", "SEGMENT(-40 -50,-40 70)", ps,
                  strategy);

    // box that is symmetric wrt the prime meridian
    std::string const box4 = "BOX(-75 -45,75 65)";

    // case 1 - point is closer to western meridian
    tester::apply("pb4-1a", "POINT(-100 10)", box4,
                  "POINT(-100 10)", "SEGMENT(-75 -45,-75 65)", ps,
                  strategy);

    // case 2 - point is closer to eastern meridian
    tester::apply("pb4-2a", "POINT(90 15)", box4,
                  "POINT(90 15)", "SEGMENT(75 -45,75 65)", ps,
                  strategy);

    // case 2 - point is at equal distance from eastern and western meridian
    tester::apply("pb4-2c1", "POINT(-180 20)", box4,
                  "POINT(-180 20)", "SEGMENT(-75 -45,-75 65)", ps,
                  strategy);

    // case 2 - point is at equal distance from eastern and western meridian
    tester::apply("pb4-2c2", "POINT(-180 20)", box4,
                  "POINT(-180 20)", "SEGMENT(75 -45,75 65)", ps,
                  strategy);
}