1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
use crate::{FromString, GetVariants, Score};

/// /// The [Aesthetic] enum represents different aesthetic values of a cock.
#[derive(Debug, PartialEq, Clone)]
pub enum Aesthetic {
    JustChopItOff,
    TooBigToBeFunctional,
    Gross,
    UglyButUsable,
    KindaMediocre,
    Normal,
    ABitBetterThanNormal,
    NiceOne,
    Cockalicious,
    Perfect,
}

/// The [Score] trait implementation for [Aesthetic] provides a score value based on the aesthetic.
impl Score for Aesthetic {
    fn score(&self) -> u32 {
        match self {
            Aesthetic::JustChopItOff => 1,
            Aesthetic::TooBigToBeFunctional => 2,
            Aesthetic::Gross => 3,
            Aesthetic::UglyButUsable => 4,
            Aesthetic::KindaMediocre => 5,
            Aesthetic::Normal => 6,
            Aesthetic::ABitBetterThanNormal => 7,
            Aesthetic::NiceOne => 8,
            Aesthetic::Cockalicious => 9,
            Aesthetic::Perfect => 10,
        }
    }
}

/// The [GetVariants] trait implementation for [Aesthetic] returns a vector of the possible variants of [Aesthetic].
impl GetVariants for Aesthetic {
    fn get_variants() -> Vec<String> {
        vec![
            String::from("JustChopItOff"),
            String::from("TooBigToBeFunctional"),
            String::from("Gross"),
            String::from("UglyButUsable"),
            String::from("KindaMediocre"),
            String::from("Normal"),
            String::from("ABitBetterThanNormal"),
            String::from("NiceOne"),
            String::from("Cockalicious"),
            String::from("Perfect"),
        ]
    }
}

/// The [FromString] trait implementation for [Aesthetic] returns an [Aesthetic] variant based on the string provided.
impl FromString for Aesthetic {
    fn from_string(aesthetic: &str) -> Aesthetic {
        match aesthetic {
            "JustChopItOff" => Aesthetic::JustChopItOff,
            "TooBigToBeFunctional" => Aesthetic::TooBigToBeFunctional,
            "Gross" => Aesthetic::Gross,
            "UglyButUsable" => Aesthetic::UglyButUsable,
            "KindaMediocre" => Aesthetic::KindaMediocre,
            "Normal" => Aesthetic::Normal,
            "ABitBetterThanNormal" => Aesthetic::ABitBetterThanNormal,
            "NiceOne" => Aesthetic::NiceOne,
            "Cockalicious" => Aesthetic::Cockalicious,
            "Perfect" => Aesthetic::Perfect,
            _ => panic!("Invalid aesthetic"),
        }
    }
}

/// [std::fmt::Display] implementation for [Aesthetic].
impl std::fmt::Display for Aesthetic {
    /// Returns a string representation of the [Aesthetic] variant.
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Aesthetic::JustChopItOff => write!(f, "Just chop it off"),
            Aesthetic::TooBigToBeFunctional => write!(f, "Too big to be functional"),
            Aesthetic::Gross => write!(f, "Gross"),
            Aesthetic::UglyButUsable => write!(f, "Ugly but usable"),
            Aesthetic::KindaMediocre => write!(f, "Kinda mediocre"),
            Aesthetic::Normal => write!(f, "Normal"),
            Aesthetic::ABitBetterThanNormal => write!(f, "A bit better than normal"),
            Aesthetic::NiceOne => write!(f, "Nice one"),
            Aesthetic::Cockalicious => write!(f, "Cockalicious"),
            Aesthetic::Perfect => write!(f, "Perfect"),
        }
    }
}

/// Unit tests for [Aesthetic].
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_aesthetic_score() {
        assert_eq!(Aesthetic::JustChopItOff.score(), 1);
        assert_eq!(Aesthetic::TooBigToBeFunctional.score(), 2);
        assert_eq!(Aesthetic::Gross.score(), 3);
        assert_eq!(Aesthetic::UglyButUsable.score(), 4);
        assert_eq!(Aesthetic::KindaMediocre.score(), 5);
        assert_eq!(Aesthetic::Normal.score(), 6);
        assert_eq!(Aesthetic::ABitBetterThanNormal.score(), 7);
        assert_eq!(Aesthetic::NiceOne.score(), 8);
        assert_eq!(Aesthetic::Cockalicious.score(), 9);
        assert_eq!(Aesthetic::Perfect.score(), 10);
    }
}