Skip to content

Commit 449d044

Browse files
committed
Add tests to type check IntoIterator implementations
1 parent 98b40cd commit 449d044

18 files changed

+383
-279
lines changed

palette/src/hsl.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -622,24 +622,12 @@ mod test {
622622
}
623623

624624
struct_of_arrays_tests!(
625-
Hsl<Srgb>,
626-
Hsl::new(0.1f32, 0.2, 0.3),
627-
Hsl::new(0.2, 0.3, 0.4),
628-
Hsl::new(0.3, 0.4, 0.5)
625+
Hsl<crate::encoding::Srgb>[hue, saturation, lightness] phantom: standard,
626+
super::Hsla::new(0.1f32, 0.2, 0.3, 0.4),
627+
super::Hsla::new(0.2, 0.3, 0.4, 0.5),
628+
super::Hsla::new(0.3, 0.4, 0.5, 0.6)
629629
);
630630

631-
mod alpha {
632-
#[cfg(feature = "alloc")]
633-
use crate::{encoding::Srgb, hsl::Hsla};
634-
635-
struct_of_arrays_tests!(
636-
Hsla<Srgb>,
637-
Hsla::new(0.1f32, 0.2, 0.3, 0.4),
638-
Hsla::new(0.2, 0.3, 0.4, 0.5),
639-
Hsla::new(0.3, 0.4, 0.5, 0.6)
640-
);
641-
}
642-
643631
#[cfg(feature = "serializing")]
644632
#[test]
645633
fn serialize() {

palette/src/hsluv.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -345,24 +345,12 @@ mod test {
345345
}
346346

347347
struct_of_arrays_tests!(
348-
Hsluv<D65>,
349-
Hsluv::new(0.1f32, 0.2, 0.3),
350-
Hsluv::new(0.2, 0.3, 0.4),
351-
Hsluv::new(0.3, 0.4, 0.5)
348+
Hsluv<D65>[hue, saturation, l] phantom: white_point,
349+
super::Hsluva::new(0.1f32, 0.2, 0.3, 0.4),
350+
super::Hsluva::new(0.2, 0.3, 0.4, 0.5),
351+
super::Hsluva::new(0.3, 0.4, 0.5, 0.6)
352352
);
353353

354-
mod alpha {
355-
#[cfg(feature = "alloc")]
356-
use crate::{hsluv::Hsluva, white_point::D65};
357-
358-
struct_of_arrays_tests!(
359-
Hsluva<D65>,
360-
Hsluva::new(0.1f32, 0.2, 0.3, 0.4),
361-
Hsluva::new(0.2, 0.3, 0.4, 0.5),
362-
Hsluva::new(0.3, 0.4, 0.5, 0.6)
363-
);
364-
}
365-
366354
#[cfg(feature = "serializing")]
367355
#[test]
368356
fn serialize() {

palette/src/hsv.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -629,24 +629,12 @@ mod test {
629629
}
630630

631631
struct_of_arrays_tests!(
632-
Hsv<Srgb>,
633-
Hsv::new(0.1f32, 0.2, 0.3),
634-
Hsv::new(0.2, 0.3, 0.4),
635-
Hsv::new(0.3, 0.4, 0.5)
632+
Hsv<crate::encoding::Srgb>[hue, saturation, value] phantom: standard,
633+
super::Hsva::new(0.1f32, 0.2, 0.3, 0.4),
634+
super::Hsva::new(0.2, 0.3, 0.4, 0.5),
635+
super::Hsva::new(0.3, 0.4, 0.5, 0.6)
636636
);
637637

638-
mod alpha {
639-
#[cfg(feature = "alloc")]
640-
use crate::{encoding::Srgb, hsv::Hsva};
641-
642-
struct_of_arrays_tests!(
643-
Hsva<Srgb>,
644-
Hsva::new(0.1f32, 0.2, 0.3, 0.4),
645-
Hsva::new(0.2, 0.3, 0.4, 0.5),
646-
Hsva::new(0.3, 0.4, 0.5, 0.6)
647-
);
648-
}
649-
650638
#[cfg(feature = "serializing")]
651639
#[test]
652640
fn serialize() {

palette/src/hwb.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -456,24 +456,12 @@ mod test {
456456
}
457457

458458
struct_of_arrays_tests!(
459-
Hwb<Srgb>,
460-
Hwb::new(0.1f32, 0.2, 0.3),
461-
Hwb::new(0.2, 0.3, 0.4),
462-
Hwb::new(0.3, 0.4, 0.5)
459+
Hwb<crate::encoding::Srgb>[hue, whiteness, blackness] phantom: standard,
460+
super::Hwba::new(0.1f32, 0.2, 0.3, 0.4),
461+
super::Hwba::new(0.2, 0.3, 0.4, 0.5),
462+
super::Hwba::new(0.3, 0.4, 0.5, 0.6)
463463
);
464464

465-
mod alpha {
466-
#[cfg(feature = "alloc")]
467-
use crate::{encoding::Srgb, hwb::Hwba};
468-
469-
struct_of_arrays_tests!(
470-
Hwba<Srgb>,
471-
Hwba::new(0.1f32, 0.2, 0.3, 0.4),
472-
Hwba::new(0.2, 0.3, 0.4, 0.5),
473-
Hwba::new(0.3, 0.4, 0.5, 0.6)
474-
);
475-
}
476-
477465
#[cfg(feature = "serializing")]
478466
#[test]
479467
fn serialize() {

palette/src/lab.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -445,24 +445,12 @@ mod test {
445445
}
446446

447447
struct_of_arrays_tests!(
448-
Lab<D65>,
449-
Lab::new(0.1f32, 0.2, 0.3),
450-
Lab::new(0.2, 0.3, 0.4),
451-
Lab::new(0.3, 0.4, 0.5)
448+
Lab<D65>[l, a, b] phantom: white_point,
449+
super::Laba::new(0.1f32, 0.2, 0.3, 0.4),
450+
super::Laba::new(0.2, 0.3, 0.4, 0.5),
451+
super::Laba::new(0.3, 0.4, 0.5, 0.6)
452452
);
453453

454-
mod alpha {
455-
#[cfg(feature = "alloc")]
456-
use crate::{lab::Laba, white_point::D65};
457-
458-
struct_of_arrays_tests!(
459-
Laba<D65>,
460-
Laba::new(0.1f32, 0.2, 0.3, 0.4),
461-
Laba::new(0.2, 0.3, 0.4, 0.5),
462-
Laba::new(0.3, 0.4, 0.5, 0.6)
463-
);
464-
}
465-
466454
#[cfg(feature = "serializing")]
467455
#[test]
468456
fn serialize() {

palette/src/lch.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -455,24 +455,12 @@ mod test {
455455
}
456456

457457
struct_of_arrays_tests!(
458-
Lch<D65>,
459-
Lch::new(0.1f32, 0.2, 0.3),
460-
Lch::new(0.2, 0.3, 0.4),
461-
Lch::new(0.3, 0.4, 0.5)
458+
Lch<D65>[l, chroma, hue] phantom: white_point,
459+
super::Lcha::new(0.1f32, 0.2, 0.3, 0.4),
460+
super::Lcha::new(0.2, 0.3, 0.4, 0.5),
461+
super::Lcha::new(0.3, 0.4, 0.5, 0.6)
462462
);
463463

464-
mod alpha {
465-
#[cfg(feature = "alloc")]
466-
use crate::{lch::Lcha, white_point::D65};
467-
468-
struct_of_arrays_tests!(
469-
Lcha<D65>,
470-
Lcha::new(0.1f32, 0.2, 0.3, 0.4),
471-
Lcha::new(0.2, 0.3, 0.4, 0.5),
472-
Lcha::new(0.3, 0.4, 0.5, 0.6)
473-
);
474-
}
475-
476464
#[cfg(feature = "serializing")]
477465
#[test]
478466
fn serialize() {

palette/src/lchuv.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -317,24 +317,12 @@ mod test {
317317
}
318318

319319
struct_of_arrays_tests!(
320-
Lchuv<D65>,
321-
Lchuv::new(0.1f32, 0.2, 0.3),
322-
Lchuv::new(0.2, 0.3, 0.4),
323-
Lchuv::new(0.3, 0.4, 0.5)
320+
Lchuv<D65>[l, chroma, hue] phantom: white_point,
321+
super::Lchuva::new(0.1f32, 0.2, 0.3, 0.4),
322+
super::Lchuva::new(0.2, 0.3, 0.4, 0.5),
323+
super::Lchuva::new(0.3, 0.4, 0.5, 0.6)
324324
);
325325

326-
mod alpha {
327-
#[cfg(feature = "alloc")]
328-
use crate::{lchuv::Lchuva, white_point::D65};
329-
330-
struct_of_arrays_tests!(
331-
Lchuva<D65>,
332-
Lchuva::new(0.1f32, 0.2, 0.3, 0.4),
333-
Lchuva::new(0.2, 0.3, 0.4, 0.5),
334-
Lchuva::new(0.3, 0.4, 0.5, 0.6)
335-
);
336-
}
337-
338326
#[cfg(feature = "serializing")]
339327
#[test]
340328
fn serialize() {

palette/src/luma/luma.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -895,24 +895,12 @@ mod test {
895895
}
896896

897897
struct_of_arrays_tests!(
898-
Luma<Srgb>,
899-
Luma::new(0.1f32),
900-
Luma::new(0.2),
901-
Luma::new(0.3)
898+
Luma<Srgb>[luma] phantom: standard,
899+
super::Lumaa::new(0.1f32, 0.4),
900+
super::Lumaa::new(0.2, 0.5),
901+
super::Lumaa::new(0.3, 0.6)
902902
);
903903

904-
mod alpha {
905-
#[cfg(feature = "alloc")]
906-
use crate::{encoding::Srgb, luma::Lumaa};
907-
908-
struct_of_arrays_tests!(
909-
Lumaa<Srgb>,
910-
Lumaa::new(0.1f32, 0.4),
911-
Lumaa::new(0.2, 0.5),
912-
Lumaa::new(0.3, 0.6)
913-
);
914-
}
915-
916904
#[cfg(feature = "serializing")]
917905
#[test]
918906
fn serialize() {

palette/src/luv.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -386,24 +386,12 @@ mod test {
386386
}
387387

388388
struct_of_arrays_tests!(
389-
Luv<D65>,
390-
Luv::new(0.1f32, 0.2, 0.3),
391-
Luv::new(0.2, 0.3, 0.4),
392-
Luv::new(0.3, 0.4, 0.5)
389+
Luv<D65>[l, u, v] phantom: white_point,
390+
super::Luva::new(0.1f32, 0.2, 0.3, 0.4),
391+
super::Luva::new(0.2, 0.3, 0.4, 0.5),
392+
super::Luva::new(0.3, 0.4, 0.5, 0.6)
393393
);
394394

395-
mod alpha {
396-
#[cfg(feature = "alloc")]
397-
use crate::{luv::Luva, white_point::D65};
398-
399-
struct_of_arrays_tests!(
400-
Luva<D65>,
401-
Luva::new(0.1f32, 0.2, 0.3, 0.4),
402-
Luva::new(0.2, 0.3, 0.4, 0.5),
403-
Luva::new(0.3, 0.4, 0.5, 0.6)
404-
);
405-
}
406-
407395
#[cfg(feature = "serializing")]
408396
#[test]
409397
fn serialize() {

0 commit comments

Comments
 (0)