mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-11 18:57:01 +00:00
Expect &Geometry
in ValidationCheck::check
This commit is contained in:
parent
5e2a9776e5
commit
ec748fc720
@ -14,10 +14,11 @@ impl Validate for Cycle {
|
||||
&self,
|
||||
config: &ValidationConfig,
|
||||
errors: &mut Vec<ValidationError>,
|
||||
_: &Geometry,
|
||||
geometry: &Geometry,
|
||||
) {
|
||||
errors.extend(
|
||||
AdjacentHalfEdgesNotConnected::check(self, config).map(Into::into),
|
||||
AdjacentHalfEdgesNotConnected::check(self, geometry, config)
|
||||
.map(Into::into),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use fj_math::{Point, Scalar};
|
||||
|
||||
use crate::{
|
||||
geometry::Geometry,
|
||||
objects::{Cycle, HalfEdge},
|
||||
storage::Handle,
|
||||
validation::{validation_check::ValidationCheck, ValidationConfig},
|
||||
@ -40,6 +41,7 @@ pub struct AdjacentHalfEdgesNotConnected {
|
||||
impl ValidationCheck<Cycle> for AdjacentHalfEdgesNotConnected {
|
||||
fn check(
|
||||
object: &Cycle,
|
||||
_: &Geometry,
|
||||
config: &ValidationConfig,
|
||||
) -> impl Iterator<Item = Self> {
|
||||
object.half_edges().pairs().filter_map(|(first, second)| {
|
||||
|
@ -12,6 +12,7 @@ pub trait ValidationCheck<T>: Sized {
|
||||
/// Run the validation check on the implementing object
|
||||
fn check(
|
||||
object: &T,
|
||||
geometry: &Geometry,
|
||||
config: &ValidationConfig,
|
||||
) -> impl Iterator<Item = Self>;
|
||||
|
||||
@ -21,10 +22,10 @@ pub trait ValidationCheck<T>: Sized {
|
||||
/// for use in unit tests), and thus always uses the default configuration.
|
||||
fn check_and_return_first_error(
|
||||
object: &T,
|
||||
_: &Geometry,
|
||||
geometry: &Geometry,
|
||||
) -> Result<(), Self> {
|
||||
let config = ValidationConfig::default();
|
||||
let mut errors = Self::check(object, &config);
|
||||
let mut errors = Self::check(object, geometry, &config);
|
||||
|
||||
if let Some(err) = errors.next() {
|
||||
return Err(err);
|
||||
@ -37,12 +38,12 @@ pub trait ValidationCheck<T>: Sized {
|
||||
///
|
||||
/// This method is designed for convenience over flexibility (it is intended
|
||||
/// for use in unit tests), and thus always uses the default configuration.
|
||||
fn check_and_expect_one_error(object: &T, _: &Geometry) -> Self
|
||||
fn check_and_expect_one_error(object: &T, geometry: &Geometry) -> Self
|
||||
where
|
||||
Self: Display,
|
||||
{
|
||||
let config = ValidationConfig::default();
|
||||
let mut errors = Self::check(object, &config).peekable();
|
||||
let mut errors = Self::check(object, geometry, &config).peekable();
|
||||
|
||||
let err = errors
|
||||
.next()
|
||||
|
Loading…
Reference in New Issue
Block a user