mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-12 14:01:47 +00:00
[test][formulas] Add test case (issue 612).
This commit is contained in:
parent
06a5435917
commit
a03155b46d
@ -1,7 +1,7 @@
|
||||
// Boost.Geometry
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2016-2018 Oracle and/or its affiliates.
|
||||
// Copyright (c) 2016-2019 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
@ -171,6 +171,20 @@ void test_all(expected_results const& results)
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_bugs()
|
||||
{
|
||||
// https://github.com/boostorg/geometry/issues/612
|
||||
{
|
||||
double lon, lat;
|
||||
bg::formula::sjoberg_intersection<double, bg::formula::andoyer_inverse, 1>
|
||||
::apply(-0.0872665, -0.0872665, -0.0872665, 0.0872665,
|
||||
0.0, 1.57e-07, -0.392699, 1.57e-07,
|
||||
lon, lat, bg::srs::spheroid<double>());
|
||||
check_one("issue 612", lon, -0.087266500535674751);
|
||||
check_one("issue 612", lat, 1.5892499139622920e-07);
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
for (size_t i = 0; i < expected_size; ++i)
|
||||
@ -178,5 +192,7 @@ int test_main(int, char*[])
|
||||
test_all(expected[i]);
|
||||
}
|
||||
|
||||
test_bugs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Boost.Geometry
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2016-2017 Oracle and/or its affiliates.
|
||||
// Copyright (c) 2016-2019 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
@ -29,21 +29,10 @@ void normalize_deg(double & deg)
|
||||
::boost::test_tools::check_is_close_t(), M, CHECK, CHECK_MSG, (L)(R)(::boost::math::fpc::percent_tolerance(T)) )
|
||||
|
||||
|
||||
void check_one(std::string const& name,
|
||||
double result, double expected, double reference, double reference_error,
|
||||
bool normalize = false, bool check_reference_only = false)
|
||||
void check_one(std::string const& name, double result, double expected)
|
||||
{
|
||||
std::string id = name.empty() ? "" : (name + " : ");
|
||||
|
||||
if (normalize)
|
||||
{
|
||||
normalize_deg(result);
|
||||
normalize_deg(expected);
|
||||
normalize_deg(reference);
|
||||
}
|
||||
|
||||
if (! check_reference_only)
|
||||
{
|
||||
double eps = std::numeric_limits<double>::epsilon();
|
||||
double abs_result = bg::math::abs(result);
|
||||
double abs_expected = bg::math::abs(expected);
|
||||
@ -72,6 +61,24 @@ void check_one(std::string const& name,
|
||||
}
|
||||
}
|
||||
|
||||
void check_one(std::string const& name,
|
||||
double result, double expected, double reference, double reference_error,
|
||||
bool normalize = false, bool check_reference_only = false)
|
||||
{
|
||||
std::string id = name.empty() ? "" : (name + " : ");
|
||||
|
||||
if (normalize)
|
||||
{
|
||||
normalize_deg(result);
|
||||
normalize_deg(expected);
|
||||
normalize_deg(reference);
|
||||
}
|
||||
|
||||
if (! check_reference_only)
|
||||
{
|
||||
check_one(name, result, expected);
|
||||
}
|
||||
|
||||
// NOTE: in some cases it probably will be necessary to normalize
|
||||
// the differences between the result and expected result
|
||||
double ref_diff = bg::math::abs(result - reference);
|
||||
|
Loading…
x
Reference in New Issue
Block a user