1use std::cmp::PartialEq;
6
7
8pub fn is_wrong<T: PartialEq<U>,U>(left: T, right: U) -> bool {
19 left != right
20}
21
22#[cfg(test)]
23mod tests {
24 use super::*;
25
26 #[test]
27 fn compare_integers() {
28 let result = is_wrong(2, 5);
29 assert_eq!(result, true);
30 }
31
32 #[test]
33 fn compare_strings_by_type() {
34 let result = is_wrong(String::from("Hi"),"Bye");
35 assert_eq!(result,true);
36 }
37
38 #[test]
39 fn compare_strings_by_same_type_string() {
40 let result = is_wrong(String::from("Hi"),String::from("Hi"));
41 assert_eq!(result,false);
42 }
43
44 #[test]
45 fn compare_strings_by_same_type_str() {
46 let result = is_wrong("Hi","Hi");
47 assert_eq!(result,false);
48 }
49
50 #[test]
51 fn compare_float() {
52 let result = is_wrong(0.7,0.8);
53 assert_eq!(result,true);
54 }
55
56 #[test]
57 fn compare_array() {
58 let result = is_wrong([1,2,3],[2,3,4]);
59 assert_eq!(result,true);
60 }
61
62 #[test]
63 fn compare_char() {
64 let result = is_wrong('A','B');
65 assert_eq!(result,true);
66 }
67
68 #[test]
69 fn compare_tuple() {
70 let result = is_wrong(('A',5,"hello"),('B',12,"sheesh"));
71 assert_eq!(result,true);
72 }
73
74 #[test]
75 fn compare_vectors() {
76 let result = is_wrong(vec!([1,2,3]),vec!([3,4,5]));
77 assert_eq!(result,true);
78 }
79}