summaryrefslogtreecommitdiff
path: root/ex4_3/src/main.rs
blob: 158c1b3ee8a711f26628514da3b0d4d180dba9ca (plain)
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
use std::cmp::PartialEq;

struct Ticket {
    title: String,
    description: String,
    status: String,
}

impl PartialEq for Ticket {
    fn eq(&self, other: &Self) -> bool {
        self.title == other.title &&
            self.description == other.description &&
            self.status == other.status
    }
}

fn main() {
    println!("Hello, world!");
}

#[cfg(test)]
mod tests {
    use crate::*;

    #[test]
    fn t0() {
        let t = Ticket{
            title: String::from("t"),
            description: String::from("d"),
            status: String::from("s"),
        };
        assert_eq!(t == t, true);
    }
}