Skip to content

Commit

Permalink
Remove TestShape
Browse files Browse the repository at this point in the history
It was once a useful tool, but we have better tools now, in the form of
the builder API.
  • Loading branch information
hannobraun committed Jun 21, 2022
1 parent f0ecc45 commit 21bb0f4
Showing 1 changed file with 6 additions and 34 deletions.
40 changes: 6 additions & 34 deletions crates/fj-kernel/src/shape/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ impl Default for Shape {

#[cfg(test)]
mod tests {
use std::ops::{Deref, DerefMut};

use fj_math::Point;

use crate::{
Expand Down Expand Up @@ -335,8 +333,8 @@ mod tests {

#[test]
fn add_edge() -> anyhow::Result<()> {
let mut shape = TestShape::new();
let mut other = TestShape::new();
let mut shape = Shape::new();
let mut other = Shape::new();

let curve = other.insert(Curve::x_axis())?;
let a = Vertex::builder(&mut other).build_from_point([1., 0., 0.])?;
Expand Down Expand Up @@ -398,8 +396,8 @@ mod tests {

#[test]
fn add_cycle() -> anyhow::Result<()> {
let mut shape = TestShape::new();
let mut other = TestShape::new();
let mut shape = Shape::new();
let mut other = Shape::new();

// Trying to refer to edge that is not from the same shape. Should fail.
let edge = Edge::builder(&mut other)
Expand All @@ -417,8 +415,8 @@ mod tests {

#[test]
fn add_face() -> anyhow::Result<()> {
let mut shape = TestShape::new();
let mut other = TestShape::new();
let mut shape = Shape::new();
let mut other = Shape::new();

let triangle = [[0., 0.], [1., 0.], [0., 1.]];

Expand Down Expand Up @@ -452,30 +450,4 @@ mod tests {

Ok(())
}

struct TestShape {
inner: Shape,
}

impl TestShape {
fn new() -> Self {
Self {
inner: Shape::new(),
}
}
}

impl Deref for TestShape {
type Target = Shape;

fn deref(&self) -> &Self::Target {
&self.inner
}
}

impl DerefMut for TestShape {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
}

0 comments on commit 21bb0f4

Please sign in to comment.