1#[derive(Debug, Clone, Copy)]
5pub struct Spacing {
6 pub xs: f32,
8 pub sm: f32,
10 pub md: f32,
12 pub lg: f32,
14 pub xl: f32,
16 pub xxl: f32,
18}
19
20impl Default for Spacing {
21 fn default() -> Self {
22 Self {
23 xs: 4.0,
24 sm: 8.0,
25 md: 16.0,
26 lg: 24.0,
27 xl: 32.0,
28 xxl: 48.0,
29 }
30 }
31}
32
33#[cfg(test)]
38mod tests {
39 use super::*;
40
41 #[test]
42 fn spacing_defaults_are_correct() {
43 let s = Spacing::default();
44 assert_eq!(s.xs, 4.0);
45 assert_eq!(s.sm, 8.0);
46 assert_eq!(s.md, 16.0);
47 assert_eq!(s.lg, 24.0);
48 assert_eq!(s.xl, 32.0);
49 assert_eq!(s.xxl, 48.0);
50 }
51
52 #[test]
53 fn spacing_values_are_ascending() {
54 let s = Spacing::default();
55 assert!(s.xs < s.sm);
56 assert!(s.sm < s.md);
57 assert!(s.md < s.lg);
58 assert!(s.lg < s.xl);
59 assert!(s.xl < s.xxl);
60 }
61}