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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
// SPDX-License-Identifier: Apache-2.0
extern crate alloc;
use ciborium::{
cbor,
value::{Integer, Value, Value::Null},
};
use rstest::rstest;
use serde_bytes::Bytes;
macro_rules! map {
($($key:expr => $val:expr),* $(,)*) => {
Value::Map(vec![$(
(
Value::serialized(&$key).unwrap(),
Value::serialized(&$val).unwrap()
)
),*])
};
}
macro_rules! arr {
($($val:expr),*) => {
Value::Array(vec![$(
Value::serialized(&$val).unwrap()
),*])
};
}
#[rstest(answer, question,
// Non-numeric simple types
case(Value::Null, cbor!(null).unwrap()),
case(Value::Bool(true), cbor!(true).unwrap()),
case(Value::Bool(false), cbor!(false).unwrap()),
case(Value::Text("foo".into()), cbor!("foo").unwrap()),
case(Value::Bytes(vec![0, 1, 2]), cbor!(Bytes::new(b"\x00\x01\x02")).unwrap()),
// Numeric simple types
case(Value::Integer(Integer::from(123)), cbor!(123).unwrap()),
case(Value::Integer(Integer::from(-123)), cbor!(-123).unwrap()),
case(Value::Float(1.23), cbor!(1.23).unwrap()),
case(Value::Float(-1.23), cbor!(-1.23).unwrap()),
case(Value::Float(2.5e+1), cbor!(2.5e+1).unwrap()),
case(Value::Float(-2.5e+1), cbor!(-2.5e+1).unwrap()),
// Simple array formulations
case(arr![], cbor!([]).unwrap()),
case(arr![Null], cbor!([null]).unwrap()),
case(arr![true], cbor!([true]).unwrap()),
case(arr![false], cbor!([false]).unwrap()),
case(arr!["foo"], cbor!(["foo"]).unwrap()),
case(arr![123], cbor!([123]).unwrap()),
case(arr![-123], cbor!([-123]).unwrap()),
case(arr![1.23], cbor!([1.23]).unwrap()),
case(arr![-1.23], cbor!([-1.23]).unwrap()),
case(arr![2.5e+1], cbor!([2.5e+1]).unwrap()),
case(arr![2.5e+1], cbor!([2.5e+1]).unwrap()),
case(arr![[1, 2]], cbor!([[1, 2]]).unwrap()),
case(arr![map! {1=>2,3=>4}], cbor!([{1=>2,3=>4}]).unwrap()),
// Two-item array formluations
case(arr![Null, Null], cbor!([null, null]).unwrap()),
case(arr![Null, true], cbor!([null, true]).unwrap()),
case(arr![Null, false], cbor!([null, false]).unwrap()),
case(arr![Null, "foo"], cbor!([null, "foo"]).unwrap()),
case(arr![Null, 123], cbor!([null, 123]).unwrap()),
case(arr![Null, -123], cbor!([null, -123]).unwrap()),
case(arr![Null, 1.23], cbor!([null, 1.23]).unwrap()),
case(arr![Null, -1.23], cbor!([null, -1.23]).unwrap()),
case(arr![Null, 2.5e+1], cbor!([null, 2.5e+1]).unwrap()),
case(arr![Null, 2.5e+1], cbor!([null, 2.5e+1]).unwrap()),
case(arr![Null, [1, 2]], cbor!([null, [1, 2]]).unwrap()),
case(arr![Null, map! {1=>2,3=>4}], cbor!([null, {1=>2,3=>4}]).unwrap()),
case(arr![true, Null], cbor!([true, null]).unwrap()),
case(arr![true, true], cbor!([true, true]).unwrap()),
case(arr![true, false], cbor!([true, false]).unwrap()),
case(arr![true, "foo"], cbor!([true, "foo"]).unwrap()),
case(arr![true, 123], cbor!([true, 123]).unwrap()),
case(arr![true, -123], cbor!([true, -123]).unwrap()),
case(arr![true, 1.23], cbor!([true, 1.23]).unwrap()),
case(arr![true, -1.23], cbor!([true, -1.23]).unwrap()),
case(arr![true, 2.5e+1], cbor!([true, 2.5e+1]).unwrap()),
case(arr![true, 2.5e+1], cbor!([true, 2.5e+1]).unwrap()),
case(arr![true, [1, 2]], cbor!([true, [1, 2]]).unwrap()),
case(arr![true, map! {1=>2,3=>4}], cbor!([true, {1=>2,3=>4}]).unwrap()),
case(arr![false, Null], cbor!([false, null]).unwrap()),
case(arr![false, true], cbor!([false, true]).unwrap()),
case(arr![false, false], cbor!([false, false]).unwrap()),
case(arr![false, "foo"], cbor!([false, "foo"]).unwrap()),
case(arr![false, 123], cbor!([false, 123]).unwrap()),
case(arr![false, -123], cbor!([false, -123]).unwrap()),
case(arr![false, 1.23], cbor!([false, 1.23]).unwrap()),
case(arr![false, -1.23], cbor!([false, -1.23]).unwrap()),
case(arr![false, 2.5e+1], cbor!([false, 2.5e+1]).unwrap()),
case(arr![false, 2.5e+1], cbor!([false, 2.5e+1]).unwrap()),
case(arr![false, [1, 2]], cbor!([false, [1, 2]]).unwrap()),
case(arr![false, map! {1=>2,3=>4}], cbor!([false, {1=>2,3=>4}]).unwrap()),
case(arr!["foo", Null], cbor!(["foo", null]).unwrap()),
case(arr!["foo", true], cbor!(["foo", true]).unwrap()),
case(arr!["foo", false], cbor!(["foo", false]).unwrap()),
case(arr!["foo", "foo"], cbor!(["foo", "foo"]).unwrap()),
case(arr!["foo", 123], cbor!(["foo", 123]).unwrap()),
case(arr!["foo", -123], cbor!(["foo", -123]).unwrap()),
case(arr!["foo", 1.23], cbor!(["foo", 1.23]).unwrap()),
case(arr!["foo", -1.23], cbor!(["foo", -1.23]).unwrap()),
case(arr!["foo", 2.5e+1], cbor!(["foo", 2.5e+1]).unwrap()),
case(arr!["foo", 2.5e+1], cbor!(["foo", 2.5e+1]).unwrap()),
case(arr!["foo", [1, 2]], cbor!(["foo", [1, 2]]).unwrap()),
case(arr!["foo", map! {1=>2,3=>4}], cbor!(["foo", {1=>2,3=>4}]).unwrap()),
case(arr![123, Null], cbor!([123, null]).unwrap()),
case(arr![123, true], cbor!([123, true]).unwrap()),
case(arr![123, false], cbor!([123, false]).unwrap()),
case(arr![123, "foo"], cbor!([123, "foo"]).unwrap()),
case(arr![123, 123], cbor!([123, 123]).unwrap()),
case(arr![123, -123], cbor!([123, -123]).unwrap()),
case(arr![123, 1.23], cbor!([123, 1.23]).unwrap()),
case(arr![123, -1.23], cbor!([123, -1.23]).unwrap()),
case(arr![123, 2.5e+1], cbor!([123, 2.5e+1]).unwrap()),
case(arr![123, 2.5e+1], cbor!([123, 2.5e+1]).unwrap()),
case(arr![123, [1, 2]], cbor!([123, [1, 2]]).unwrap()),
case(arr![123, map! {1=>2,3=>4}], cbor!([123, {1=>2,3=>4}]).unwrap()),
case(arr![-123, Null], cbor!([-123, null]).unwrap()),
case(arr![-123, true], cbor!([-123, true]).unwrap()),
case(arr![-123, false], cbor!([-123, false]).unwrap()),
case(arr![-123, "foo"], cbor!([-123, "foo"]).unwrap()),
case(arr![-123, 123], cbor!([-123, 123]).unwrap()),
case(arr![-123, -123], cbor!([-123, -123]).unwrap()),
case(arr![-123, 1.23], cbor!([-123, 1.23]).unwrap()),
case(arr![-123, -1.23], cbor!([-123, -1.23]).unwrap()),
case(arr![-123, 2.5e+1], cbor!([-123, 2.5e+1]).unwrap()),
case(arr![-123, 2.5e+1], cbor!([-123, 2.5e+1]).unwrap()),
case(arr![-123, [1, 2]], cbor!([-123, [1, 2]]).unwrap()),
case(arr![-123, map! {1=>2,3=>4}], cbor!([-123, {1=>2,3=>4}]).unwrap()),
case(arr![1.23, Null], cbor!([1.23, null]).unwrap()),
case(arr![1.23, true], cbor!([1.23, true]).unwrap()),
case(arr![1.23, false], cbor!([1.23, false]).unwrap()),
case(arr![1.23, "foo"], cbor!([1.23, "foo"]).unwrap()),
case(arr![1.23, 123], cbor!([1.23, 123]).unwrap()),
case(arr![1.23, -123], cbor!([1.23, -123]).unwrap()),
case(arr![1.23, 1.23], cbor!([1.23, 1.23]).unwrap()),
case(arr![1.23, -1.23], cbor!([1.23, -1.23]).unwrap()),
case(arr![1.23, 2.5e+1], cbor!([1.23, 2.5e+1]).unwrap()),
case(arr![1.23, 2.5e+1], cbor!([1.23, 2.5e+1]).unwrap()),
case(arr![1.23, [1, 2]], cbor!([1.23, [1, 2]]).unwrap()),
case(arr![1.23, map! {1=>2,3=>4}], cbor!([1.23, {1=>2,3=>4}]).unwrap()),
case(arr![-1.23, Null], cbor!([-1.23, null]).unwrap()),
case(arr![-1.23, true], cbor!([-1.23, true]).unwrap()),
case(arr![-1.23, false], cbor!([-1.23, false]).unwrap()),
case(arr![-1.23, "foo"], cbor!([-1.23, "foo"]).unwrap()),
case(arr![-1.23, 123], cbor!([-1.23, 123]).unwrap()),
case(arr![-1.23, -123], cbor!([-1.23, -123]).unwrap()),
case(arr![-1.23, 1.23], cbor!([-1.23, 1.23]).unwrap()),
case(arr![-1.23, -1.23], cbor!([-1.23, -1.23]).unwrap()),
case(arr![-1.23, 2.5e+1], cbor!([-1.23, 2.5e+1]).unwrap()),
case(arr![-1.23, 2.5e+1], cbor!([-1.23, 2.5e+1]).unwrap()),
case(arr![-1.23, [1, 2]], cbor!([-1.23, [1, 2]]).unwrap()),
case(arr![-1.23, map! {1=>2,3=>4}], cbor!([-1.23, {1=>2,3=>4}]).unwrap()),
case(arr![2.5e+1, Null], cbor!([2.5e+1, null]).unwrap()),
case(arr![2.5e+1, true], cbor!([2.5e+1, true]).unwrap()),
case(arr![2.5e+1, false], cbor!([2.5e+1, false]).unwrap()),
case(arr![2.5e+1, "foo"], cbor!([2.5e+1, "foo"]).unwrap()),
case(arr![2.5e+1, 123], cbor!([2.5e+1, 123]).unwrap()),
case(arr![2.5e+1, -123], cbor!([2.5e+1, -123]).unwrap()),
case(arr![2.5e+1, 1.23], cbor!([2.5e+1, 1.23]).unwrap()),
case(arr![2.5e+1, -1.23], cbor!([2.5e+1, -1.23]).unwrap()),
case(arr![2.5e+1, 2.5e+1], cbor!([2.5e+1, 2.5e+1]).unwrap()),
case(arr![2.5e+1, 2.5e+1], cbor!([2.5e+1, 2.5e+1]).unwrap()),
case(arr![2.5e+1, [1, 2]], cbor!([2.5e+1, [1, 2]]).unwrap()),
case(arr![2.5e+1, map! {1=>2,3=>4}], cbor!([2.5e+1, {1=>2,3=>4}]).unwrap()),
case(arr![2.5e+1, Null], cbor!([2.5e+1, null]).unwrap()),
case(arr![2.5e+1, true], cbor!([2.5e+1, true]).unwrap()),
case(arr![2.5e+1, false], cbor!([2.5e+1, false]).unwrap()),
case(arr![2.5e+1, "foo"], cbor!([2.5e+1, "foo"]).unwrap()),
case(arr![2.5e+1, 123], cbor!([2.5e+1, 123]).unwrap()),
case(arr![2.5e+1, -123], cbor!([2.5e+1, -123]).unwrap()),
case(arr![2.5e+1, 1.23], cbor!([2.5e+1, 1.23]).unwrap()),
case(arr![2.5e+1, -1.23], cbor!([2.5e+1, -1.23]).unwrap()),
case(arr![2.5e+1, 2.5e+1], cbor!([2.5e+1, 2.5e+1]).unwrap()),
case(arr![2.5e+1, 2.5e+1], cbor!([2.5e+1, 2.5e+1]).unwrap()),
case(arr![2.5e+1, [1, 2]], cbor!([2.5e+1, [1, 2]]).unwrap()),
case(arr![2.5e+1, map! {1=>2,3=>4}], cbor!([2.5e+1, {1=>2,3=>4}]).unwrap()),
case(arr![[1, 2], Null], cbor!([[1, 2], null]).unwrap()),
case(arr![[1, 2], true], cbor!([[1, 2], true]).unwrap()),
case(arr![[1, 2], false], cbor!([[1, 2], false]).unwrap()),
case(arr![[1, 2], "foo"], cbor!([[1, 2], "foo"]).unwrap()),
case(arr![[1, 2], 123], cbor!([[1, 2], 123]).unwrap()),
case(arr![[1, 2], -123], cbor!([[1, 2], -123]).unwrap()),
case(arr![[1, 2], 1.23], cbor!([[1, 2], 1.23]).unwrap()),
case(arr![[1, 2], -1.23], cbor!([[1, 2], -1.23]).unwrap()),
case(arr![[1, 2], 2.5e+1], cbor!([[1, 2], 2.5e+1]).unwrap()),
case(arr![[1, 2], 2.5e+1], cbor!([[1, 2], 2.5e+1]).unwrap()),
case(arr![[1, 2], [1, 2]], cbor!([[1, 2], [1, 2]]).unwrap()),
case(arr![[1, 2], map! {1=>2,3=>4}], cbor!([[1, 2], {1=>2,3=>4}]).unwrap()),
case(arr![map! {1=>2,3=>4}, Null], cbor!([{1=>2,3=>4}, null]).unwrap()),
case(arr![map! {1=>2,3=>4}, true], cbor!([{1=>2,3=>4}, true]).unwrap()),
case(arr![map! {1=>2,3=>4}, false], cbor!([{1=>2,3=>4}, false]).unwrap()),
case(arr![map! {1=>2,3=>4}, "foo"], cbor!([{1=>2,3=>4}, "foo"]).unwrap()),
case(arr![map! {1=>2,3=>4}, 123], cbor!([{1=>2,3=>4}, 123]).unwrap()),
case(arr![map! {1=>2,3=>4}, -123], cbor!([{1=>2,3=>4}, -123]).unwrap()),
case(arr![map! {1=>2,3=>4}, 1.23], cbor!([{1=>2,3=>4}, 1.23]).unwrap()),
case(arr![map! {1=>2,3=>4}, -1.23], cbor!([{1=>2,3=>4}, -1.23]).unwrap()),
case(arr![map! {1=>2,3=>4}, 2.5e+1], cbor!([{1=>2,3=>4}, 2.5e+1]).unwrap()),
case(arr![map! {1=>2,3=>4}, 2.5e+1], cbor!([{1=>2,3=>4}, 2.5e+1]).unwrap()),
case(arr![map! {1=>2,3=>4}, [1, 2]], cbor!([{1=>2,3=>4}, [1, 2]]).unwrap()),
case(arr![map! {1=>2,3=>4}, map! {1=>2,3=>4}], cbor!([{1=>2,3=>4}, {1=>2,3=>4}]).unwrap()),
// Map formulations
case(map! {}, cbor!({}).unwrap()),
case(map! {Null => Null}, cbor!({ null => null }).unwrap()),
case(map! {Null => true}, cbor!({ null => true }).unwrap()),
case(map! {Null => false}, cbor!({ null => false }).unwrap()),
case(map! {Null => "foo"}, cbor!({ null => "foo" }).unwrap()),
case(map! {Null => 123}, cbor!({ null => 123 }).unwrap()),
case(map! {Null => -123}, cbor!({ null => -123 }).unwrap()),
case(map! {Null => 1.23}, cbor!({ null => 1.23 }).unwrap()),
case(map! {Null => -1.23}, cbor!({ null => -1.23 }).unwrap()),
case(map! {Null => 2.5e+1}, cbor!({ null => 2.5e+1 }).unwrap()),
case(map! {Null => 2.5e+1}, cbor!({ null => 2.5e+1 }).unwrap()),
case(map! {Null => [1, 2]}, cbor!({ null => [1, 2] }).unwrap()),
case(map! {Null => map! {1=>2,3=>4}}, cbor!({ null => {1=>2,3=>4} }).unwrap()),
case(map! {true => Null}, cbor!({ true => null }).unwrap()),
case(map! {true => true}, cbor!({ true => true }).unwrap()),
case(map! {true => false}, cbor!({ true => false }).unwrap()),
case(map! {true => "foo"}, cbor!({ true => "foo" }).unwrap()),
case(map! {true => 123}, cbor!({ true => 123 }).unwrap()),
case(map! {true => -123}, cbor!({ true => -123 }).unwrap()),
case(map! {true => 1.23}, cbor!({ true => 1.23 }).unwrap()),
case(map! {true => -1.23}, cbor!({ true => -1.23 }).unwrap()),
case(map! {true => 2.5e+1}, cbor!({ true => 2.5e+1 }).unwrap()),
case(map! {true => 2.5e+1}, cbor!({ true => 2.5e+1 }).unwrap()),
case(map! {true => [1, 2]}, cbor!({ true => [1, 2] }).unwrap()),
case(map! {true => map! {1=>2,3=>4}}, cbor!({ true => {1=>2,3=>4} }).unwrap()),
case(map! {false => Null}, cbor!({ false => null }).unwrap()),
case(map! {false => true}, cbor!({ false => true }).unwrap()),
case(map! {false => false}, cbor!({ false => false }).unwrap()),
case(map! {false => "foo"}, cbor!({ false => "foo" }).unwrap()),
case(map! {false => 123}, cbor!({ false => 123 }).unwrap()),
case(map! {false => -123}, cbor!({ false => -123 }).unwrap()),
case(map! {false => 1.23}, cbor!({ false => 1.23 }).unwrap()),
case(map! {false => -1.23}, cbor!({ false => -1.23 }).unwrap()),
case(map! {false => 2.5e+1}, cbor!({ false => 2.5e+1 }).unwrap()),
case(map! {false => 2.5e+1}, cbor!({ false => 2.5e+1 }).unwrap()),
case(map! {false => [1, 2]}, cbor!({ false => [1, 2] }).unwrap()),
case(map! {false => map! {1=>2,3=>4}}, cbor!({ false => {1=>2,3=>4} }).unwrap()),
case(map! {"foo" => Null}, cbor!({ "foo" => null }).unwrap()),
case(map! {"foo" => true}, cbor!({ "foo" => true }).unwrap()),
case(map! {"foo" => false}, cbor!({ "foo" => false }).unwrap()),
case(map! {"foo" => "foo"}, cbor!({ "foo" => "foo" }).unwrap()),
case(map! {"foo" => 123}, cbor!({ "foo" => 123 }).unwrap()),
case(map! {"foo" => -123}, cbor!({ "foo" => -123 }).unwrap()),
case(map! {"foo" => 1.23}, cbor!({ "foo" => 1.23 }).unwrap()),
case(map! {"foo" => -1.23}, cbor!({ "foo" => -1.23 }).unwrap()),
case(map! {"foo" => 2.5e+1}, cbor!({ "foo" => 2.5e+1 }).unwrap()),
case(map! {"foo" => 2.5e+1}, cbor!({ "foo" => 2.5e+1 }).unwrap()),
case(map! {"foo" => [1, 2]}, cbor!({ "foo" => [1, 2] }).unwrap()),
case(map! {"foo" => map! {1=>2,3=>4}}, cbor!({ "foo" => {1=>2,3=>4} }).unwrap()),
case(map! {123 => Null}, cbor!({ 123 => null }).unwrap()),
case(map! {123 => true}, cbor!({ 123 => true }).unwrap()),
case(map! {123 => false}, cbor!({ 123 => false }).unwrap()),
case(map! {123 => "foo"}, cbor!({ 123 => "foo" }).unwrap()),
case(map! {123 => 123}, cbor!({ 123 => 123 }).unwrap()),
case(map! {123 => -123}, cbor!({ 123 => -123 }).unwrap()),
case(map! {123 => 1.23}, cbor!({ 123 => 1.23 }).unwrap()),
case(map! {123 => -1.23}, cbor!({ 123 => -1.23 }).unwrap()),
case(map! {123 => 2.5e+1}, cbor!({ 123 => 2.5e+1 }).unwrap()),
case(map! {123 => 2.5e+1}, cbor!({ 123 => 2.5e+1 }).unwrap()),
case(map! {123 => [1, 2]}, cbor!({ 123 => [1, 2] }).unwrap()),
case(map! {123 => map! {1=>2,3=>4}}, cbor!({ 123 => {1=>2,3=>4} }).unwrap()),
case(map! {-123 => Null}, cbor!({ -123 => null }).unwrap()),
case(map! {-123 => true}, cbor!({ -123 => true }).unwrap()),
case(map! {-123 => false}, cbor!({ -123 => false }).unwrap()),
case(map! {-123 => "foo"}, cbor!({ -123 => "foo" }).unwrap()),
case(map! {-123 => 123}, cbor!({ -123 => 123 }).unwrap()),
case(map! {-123 => -123}, cbor!({ -123 => -123 }).unwrap()),
case(map! {-123 => 1.23}, cbor!({ -123 => 1.23 }).unwrap()),
case(map! {-123 => -1.23}, cbor!({ -123 => -1.23 }).unwrap()),
case(map! {-123 => 2.5e+1}, cbor!({ -123 => 2.5e+1 }).unwrap()),
case(map! {-123 => 2.5e+1}, cbor!({ -123 => 2.5e+1 }).unwrap()),
case(map! {-123 => [1, 2]}, cbor!({ -123 => [1, 2] }).unwrap()),
case(map! {-123 => map! {1=>2,3=>4}}, cbor!({ -123 => {1=>2,3=>4} }).unwrap()),
case(map! {1.23 => Null}, cbor!({ 1.23 => null }).unwrap()),
case(map! {1.23 => true}, cbor!({ 1.23 => true }).unwrap()),
case(map! {1.23 => false}, cbor!({ 1.23 => false }).unwrap()),
case(map! {1.23 => "foo"}, cbor!({ 1.23 => "foo" }).unwrap()),
case(map! {1.23 => 123}, cbor!({ 1.23 => 123 }).unwrap()),
case(map! {1.23 => -123}, cbor!({ 1.23 => -123 }).unwrap()),
case(map! {1.23 => 1.23}, cbor!({ 1.23 => 1.23 }).unwrap()),
case(map! {1.23 => -1.23}, cbor!({ 1.23 => -1.23 }).unwrap()),
case(map! {1.23 => 2.5e+1}, cbor!({ 1.23 => 2.5e+1 }).unwrap()),
case(map! {1.23 => 2.5e+1}, cbor!({ 1.23 => 2.5e+1 }).unwrap()),
case(map! {1.23 => [1, 2]}, cbor!({ 1.23 => [1, 2] }).unwrap()),
case(map! {1.23 => map! {1=>2,3=>4}}, cbor!({ 1.23 => {1=>2,3=>4} }).unwrap()),
case(map! {-1.23 => Null}, cbor!({ -1.23 => null }).unwrap()),
case(map! {-1.23 => true}, cbor!({ -1.23 => true }).unwrap()),
case(map! {-1.23 => false}, cbor!({ -1.23 => false }).unwrap()),
case(map! {-1.23 => "foo"}, cbor!({ -1.23 => "foo" }).unwrap()),
case(map! {-1.23 => 123}, cbor!({ -1.23 => 123 }).unwrap()),
case(map! {-1.23 => -123}, cbor!({ -1.23 => -123 }).unwrap()),
case(map! {-1.23 => 1.23}, cbor!({ -1.23 => 1.23 }).unwrap()),
case(map! {-1.23 => -1.23}, cbor!({ -1.23 => -1.23 }).unwrap()),
case(map! {-1.23 => 2.5e+1}, cbor!({ -1.23 => 2.5e+1 }).unwrap()),
case(map! {-1.23 => 2.5e+1}, cbor!({ -1.23 => 2.5e+1 }).unwrap()),
case(map! {-1.23 => [1, 2]}, cbor!({ -1.23 => [1, 2] }).unwrap()),
case(map! {-1.23 => map! {1=>2,3=>4}}, cbor!({ -1.23 => {1=>2,3=>4} }).unwrap()),
case(map! {2.5e+1 => Null}, cbor!({ 2.5e+1 => null }).unwrap()),
case(map! {2.5e+1 => true}, cbor!({ 2.5e+1 => true }).unwrap()),
case(map! {2.5e+1 => false}, cbor!({ 2.5e+1 => false }).unwrap()),
case(map! {2.5e+1 => "foo"}, cbor!({ 2.5e+1 => "foo" }).unwrap()),
case(map! {2.5e+1 => 123}, cbor!({ 2.5e+1 => 123 }).unwrap()),
case(map! {2.5e+1 => -123}, cbor!({ 2.5e+1 => -123 }).unwrap()),
case(map! {2.5e+1 => 1.23}, cbor!({ 2.5e+1 => 1.23 }).unwrap()),
case(map! {2.5e+1 => -1.23}, cbor!({ 2.5e+1 => -1.23 }).unwrap()),
case(map! {2.5e+1 => 2.5e+1}, cbor!({ 2.5e+1 => 2.5e+1 }).unwrap()),
case(map! {2.5e+1 => 2.5e+1}, cbor!({ 2.5e+1 => 2.5e+1 }).unwrap()),
case(map! {2.5e+1 => [1, 2]}, cbor!({ 2.5e+1 => [1, 2] }).unwrap()),
case(map! {2.5e+1 => map! {1=>2,3=>4}}, cbor!({ 2.5e+1 => {1=>2,3=>4} }).unwrap()),
case(map! {2.5e+1 => Null}, cbor!({ 2.5e+1 => null }).unwrap()),
case(map! {2.5e+1 => true}, cbor!({ 2.5e+1 => true }).unwrap()),
case(map! {2.5e+1 => false}, cbor!({ 2.5e+1 => false }).unwrap()),
case(map! {2.5e+1 => "foo"}, cbor!({ 2.5e+1 => "foo" }).unwrap()),
case(map! {2.5e+1 => 123}, cbor!({ 2.5e+1 => 123 }).unwrap()),
case(map! {2.5e+1 => -123}, cbor!({ 2.5e+1 => -123 }).unwrap()),
case(map! {2.5e+1 => 1.23}, cbor!({ 2.5e+1 => 1.23 }).unwrap()),
case(map! {2.5e+1 => -1.23}, cbor!({ 2.5e+1 => -1.23 }).unwrap()),
case(map! {2.5e+1 => 2.5e+1}, cbor!({ 2.5e+1 => 2.5e+1 }).unwrap()),
case(map! {2.5e+1 => 2.5e+1}, cbor!({ 2.5e+1 => 2.5e+1 }).unwrap()),
case(map! {2.5e+1 => [1, 2]}, cbor!({ 2.5e+1 => [1, 2] }).unwrap()),
case(map! {2.5e+1 => map! {1=>2,3=>4}}, cbor!({ 2.5e+1 => {1=>2,3=>4} }).unwrap()),
case(map! {[1, 2] => Null}, cbor!({ [1, 2] => null }).unwrap()),
case(map! {[1, 2] => true}, cbor!({ [1, 2] => true }).unwrap()),
case(map! {[1, 2] => false}, cbor!({ [1, 2] => false }).unwrap()),
case(map! {[1, 2] => "foo"}, cbor!({ [1, 2] => "foo" }).unwrap()),
case(map! {[1, 2] => 123}, cbor!({ [1, 2] => 123 }).unwrap()),
case(map! {[1, 2] => -123}, cbor!({ [1, 2] => -123 }).unwrap()),
case(map! {[1, 2] => 1.23}, cbor!({ [1, 2] => 1.23 }).unwrap()),
case(map! {[1, 2] => -1.23}, cbor!({ [1, 2] => -1.23 }).unwrap()),
case(map! {[1, 2] => 2.5e+1}, cbor!({ [1, 2] => 2.5e+1 }).unwrap()),
case(map! {[1, 2] => 2.5e+1}, cbor!({ [1, 2] => 2.5e+1 }).unwrap()),
case(map! {[1, 2] => [1, 2]}, cbor!({ [1, 2] => [1, 2] }).unwrap()),
case(map! {[1, 2] => map! {1=>2,3=>4}}, cbor!({ [1, 2] => {1=>2,3=>4} }).unwrap()),
case(map! {map! {1=>2,3=>4} => Null}, cbor!({ {1=>2,3=>4} => null }).unwrap()),
case(map! {map! {1=>2,3=>4} => true}, cbor!({ {1=>2,3=>4} => true }).unwrap()),
case(map! {map! {1=>2,3=>4} => false}, cbor!({ {1=>2,3=>4} => false }).unwrap()),
case(map! {map! {1=>2,3=>4} => "foo"}, cbor!({ {1=>2,3=>4} => "foo" }).unwrap()),
case(map! {map! {1=>2,3=>4} => 123}, cbor!({ {1=>2,3=>4} => 123 }).unwrap()),
case(map! {map! {1=>2,3=>4} => -123}, cbor!({ {1=>2,3=>4} => -123 }).unwrap()),
case(map! {map! {1=>2,3=>4} => 1.23}, cbor!({ {1=>2,3=>4} => 1.23 }).unwrap()),
case(map! {map! {1=>2,3=>4} => -1.23}, cbor!({ {1=>2,3=>4} => -1.23 }).unwrap()),
case(map! {map! {1=>2,3=>4} => 2.5e+1}, cbor!({ {1=>2,3=>4} => 2.5e+1 }).unwrap()),
case(map! {map! {1=>2,3=>4} => 2.5e+1}, cbor!({ {1=>2,3=>4} => 2.5e+1 }).unwrap()),
case(map! {map! {1=>2,3=>4} => [1, 2]}, cbor!({ {1=>2,3=>4} => [1, 2] }).unwrap()),
case(map! {map! {1=>2,3=>4} => map! {1=>2,3=>4}}, cbor!({ {1=>2,3=>4} => {1=>2,3=>4} }).unwrap()),
)]
fn test(answer: Value, question: Value) {
assert_eq!(answer, question);
}
|