fn invalid_inputs_are_refused_and_extreme_direction_scales_normalize() {
    for bad in [f64::NAN, f64::INFINITY, f64::NEG_INFINITY, -0.01, 64.01] {
        assert!(DirectionalLight::new(Vec3::Z, Vec3::new(1.0, 1.0, 1.0), bad).is_err());
    }
    for bad in [f64::NAN, f64::INFINITY, -0.01, 1.01] {
        assert!(DirectionalLight::new(Vec3::Z, Vec3::new(bad, 1.0, 1.0), 1.0).is_err());
    }
    for bad in [Vec3::ZERO, Vec3::new(f64::NAN, 0.0, 1.0)] {
        assert!(DirectionalLight::new(bad, Vec3::ZERO, 1.0).is_err());
        assert!(Lighting::default().shade_linear(lambert(), bad, Vec3::Z, |_, _| Ok(true)).is_err());
        assert!(Lighting::default().shade_linear(lambert(), Vec3::Z, bad, |_, _| Ok(true)).is_err());
    }
    let white = Vec3::new(1.0, 1.0, 1.0);
    for magnitude in [1e-300, 1e308] {
        let direction = DirectionalLight::new(Vec3::new(magnitude, magnitude, magnitude), white, 1.0).unwrap().direction();
        assert!((direction.len() - 1.0).abs() < 1e-14);
    }
    let light = DirectionalLight::new(Vec3::Z, white, MAX_LIGHT_INTENSITY).unwrap();
    assert!(Lighting::new(vec![light; MAX_LIGHTS]).is_ok());
    assert!(Lighting::new(vec![light; MAX_LIGHTS + 1]).is_err());
    let excess_capacity = Vec::<DirectionalLight>::with_capacity(MAX_LIGHTS + 1);
    assert_eq!(excess_capacity.len(), 0);
    assert!(Lighting::new(excess_capacity).is_err(), "empty vectors cannot retain an unbounded light allocation");
    for bad in [f64::NAN, f64::INFINITY, -16.01, 16.01] {
        assert!(map_to_display(Vec3::ZERO, bad).is_err());
    }
    for bad in [f64::NAN, f64::INFINITY, -1.0, MAX_LINEAR_RADIANCE * 2.0] {
        assert!(map_to_display(Vec3::new(bad, 0.0, 0.0), 0.0).is_err());
    }
}