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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#[cfg(test)]
mod tests {
use serde_yml::Value;
// Tests for equality comparison with owned string
#[test]
fn test_eq_string() {
assert_eq!(Value::String("lorem".into()), *"lorem");
}
// Tests for equality comparison with string literal
#[test]
fn test_eq_str() {
assert_eq!(Value::String("lorem".into()), "lorem");
}
// Tests for equality comparison with owned string
#[test]
fn test_eq_string_owned() {
assert_eq!(Value::String("lorem".into()), "lorem".to_string());
}
// Tests for equality comparison with boolean
#[test]
fn test_eq_bool() {
assert_eq!(Value::Bool(true), true);
}
// Tests for equality comparison with i8
#[test]
fn test_eq_i8() {
assert_eq!(Value::Number(10.into()), 10i8);
}
// Tests for equality comparison with i16
#[test]
fn test_eq_i16() {
assert_eq!(Value::Number(10.into()), 10i16);
}
// Tests for equality comparison with i32
#[test]
fn test_eq_i32() {
assert_eq!(Value::Number(10.into()), 10i32);
}
// Tests for equality comparison with i64
#[test]
fn test_eq_i64() {
assert_eq!(Value::Number(10.into()), 10i64);
}
// Tests for equality comparison with isize
#[test]
fn test_eq_isize() {
assert_eq!(Value::Number(10.into()), 10isize);
}
// Tests for equality comparison with u8
#[test]
fn test_eq_u8() {
assert_eq!(Value::Number(10.into()), 10u8);
}
// Tests for equality comparison with u16
#[test]
fn test_eq_u16() {
assert_eq!(Value::Number(10.into()), 10u16);
}
// Tests for equality comparison with u32
#[test]
fn test_eq_u32() {
assert_eq!(Value::Number(10.into()), 10u32);
}
// Tests for equality comparison with u64
#[test]
fn test_eq_u64() {
assert_eq!(Value::Number(10.into()), 10u64);
}
// Tests for equality comparison with usize
#[test]
fn test_eq_usize() {
assert_eq!(Value::Number(10.into()), 10usize);
}
// Tests for equality comparison with f32
#[test]
fn test_eq_f32() {
assert_eq!(Value::Number(10.0.into()), 10.0f32);
}
// Tests for equality comparison with f64
#[test]
fn test_eq_f64() {
assert_eq!(Value::Number(10.0.into()), 10.0f64);
}
// Tests for inequality comparison with owned string
#[test]
fn test_ne_string() {
assert_ne!(Value::String("lorem".into()), *"ipsum");
}
// Tests for inequality comparison with boolean
#[test]
fn test_ne_bool() {
assert_ne!(Value::Bool(true), false);
}
// Tests for inequality comparison with number
#[test]
fn test_ne_number() {
assert_ne!(Value::Number(10.into()), 20i32);
}
// Tests for inequality comparison with incompatible types
#[test]
fn test_ne_incompatible_types() {
assert_ne!(Value::String("lorem".into()), true);
assert_ne!(Value::Bool(true), 10i32);
assert_ne!(Value::Number(10.into()), "10");
}
// Tests for equality comparison with reference
#[test]
fn test_eq_ref() {
let v = Value::String("lorem".into());
assert_eq!(&v, "lorem");
}
// Tests for equality comparison with mutable reference
#[test]
fn test_eq_mut_ref() {
let mut v = Value::Number(10.into());
assert_eq!(&mut v, 10i32);
}
// Tests for equality comparison with minimum and maximum values
#[test]
fn test_eq_min_max() {
assert_eq!(Value::Number(i64::MIN.into()), i64::MIN);
assert_eq!(Value::Number(i64::MAX.into()), i64::MAX);
assert_eq!(Value::Number(u64::MAX.into()), u64::MAX);
assert_eq!(Value::Number(f64::MIN.into()), f64::MIN);
assert_eq!(Value::Number(f64::MAX.into()), f64::MAX);
}
}