Skip to content

Commit

Permalink
continue to run Relate tests regardless of precision model
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkirk committed Jul 19, 2022
1 parent 69de9c7 commit 006a773
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion geo/tests/jts_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn init_logging() {
fn test_all_general() {
init_logging();

let mut runner = TestRunner::new().with_precision_floating();
let mut runner = TestRunner::new().with_overlay_precision_floating();
runner.run().expect("test cases failed");

// sanity check that *something* was run
Expand Down
6 changes: 3 additions & 3 deletions jts-test-runner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ mod tests {
// several of the ConvexHull tests are currently failing
fn test_all_general() {
init_logging();
let mut runner = TestRunner::new().with_precision_floating();
let mut runner = TestRunner::new().with_overlay_precision_floating();
runner.run().expect("test cases failed");

// sanity check that the expected number of tests were run.
//
// We'll need to increase this number as more tests are added, but it should never be
// decreased.
let expected_test_count: usize = 227;
let expected_test_count: usize = 274;
let actual_test_count = runner.failures().len() + runner.successes().len();
match actual_test_count.cmp(&expected_test_count) {
Ordering::Less => {
Expand Down Expand Up @@ -98,7 +98,7 @@ mod tests {
init_logging();
let mut runner = TestRunner::new()
.matching_filename_glob("*Overlay*.xml")
.with_precision_floating();
.with_overlay_precision_floating();
runner.run().expect("test cases failed");

// sanity check that *something* was run
Expand Down
30 changes: 16 additions & 14 deletions jts-test-runner/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const GENERAL_TEST_XML: Dir = include_dir!("$CARGO_MANIFEST_DIR/resources/testxm
pub struct TestRunner {
filename_filter: Option<String>,
desc_filter: Option<String>,
check_precision: bool,
check_overlay_precision: bool,
cases: Option<Vec<TestCase>>,
failures: Vec<TestFailure>,
unsupported: Vec<TestCase>,
Expand Down Expand Up @@ -71,8 +71,8 @@ impl TestRunner {
self
}

pub fn with_precision_floating(mut self) -> Self {
self.check_precision = true;
pub fn with_overlay_precision_floating(mut self) -> Self {
self.check_overlay_precision = true;
self
}

Expand Down Expand Up @@ -513,17 +513,7 @@ impl TestRunner {
continue;
}
};
if self.check_precision
&& run.precision_model.is_some()
&& &run.precision_model.as_ref().unwrap().ty != "FLOATING"
{
debug!(
"skipping test input: {:?} with unsupported precision model: {prec:?}",
file.path(),
prec = run.precision_model,
);
continue;
}

for mut case in run.cases {
if let Some(desc_filter) = &self.desc_filter {
if case.desc.as_str().contains(desc_filter) {
Expand All @@ -548,6 +538,18 @@ impl TestRunner {

match test.operation_input.into_operation(&case) {
Ok(operation) => {
if matches!(operation, Operation::BooleanOp { .. })
&& self.check_overlay_precision
&& run.precision_model.is_some()
&& &run.precision_model.as_ref().unwrap().ty != "FLOATING"
{
debug!(
"skipping test input: {:?} with unsupported precision model: {prec:?}",
file.path(),
prec = run.precision_model,
);
continue;
}
cases.push(TestCase {
description,
test_file_name,
Expand Down

0 comments on commit 006a773

Please sign in to comment.