Skip to content

Commit

Permalink
updated the test such that they would pass
Browse files Browse the repository at this point in the history
  • Loading branch information
waridh committed Sep 2, 2024
1 parent 5e662eb commit b97401c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/hittable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ mod test {
use super::*;
use crate::sphere::Sphere;

fn create_rc_sphere(x: f32, y: f32, z: f32, r: f32) -> rc::Rc<Sphere> {
fn create_rc_sphere(x: f32, y: f32, z: f32, r: f32) -> Arc<Sphere> {
let sphere = Sphere::from((x, y, z, r));
rc::Rc::new(sphere)
Arc::new(sphere)
}

/// Ensures that creation of the data structure does not fail
#[test]
fn create_list() {
let mut list = HittableList::new();
let item_1: Rc<dyn Hittable> = create_rc_sphere(0., 1., 2., 50.);
let item_2: Rc<dyn Hittable> = create_rc_sphere(100., 1., 2., 1.);
let item_1: Arc<dyn Hittable> = create_rc_sphere(0., 1., 2., 50.);
let item_2: Arc<dyn Hittable> = create_rc_sphere(100., 1., 2., 1.);

list.push(&item_1);
list.push(&item_2);
Expand All @@ -125,8 +125,8 @@ mod test {
#[test]
fn clear_list() {
let mut list = HittableList::new();
let item_1: Rc<dyn Hittable> = create_rc_sphere(0., 1., 2., 50.);
let item_2: Rc<dyn Hittable> = create_rc_sphere(100., 1., 2., 1.);
let item_1: Arc<dyn Hittable> = create_rc_sphere(0., 1., 2., 50.);
let item_2: Arc<dyn Hittable> = create_rc_sphere(100., 1., 2., 1.);

list.push(&item_1);
list.push(&item_2);
Expand All @@ -141,8 +141,8 @@ mod test {
#[test]
fn hit_one_thing() {
let mut list = HittableList::new();
let item_1: Rc<dyn Hittable> = create_rc_sphere(0., 1., 2., 0.25);
let item_2: Rc<dyn Hittable> = create_rc_sphere(100., 1., 2., 1.);
let item_1: Arc<dyn Hittable> = create_rc_sphere(0., 1., 2., 0.25);
let item_2: Arc<dyn Hittable> = create_rc_sphere(100., 1., 2., 1.);

let origin = vec3::Vec3(0., 0., 0.);

Expand Down

0 comments on commit b97401c

Please sign in to comment.