We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 046b87a commit 78b49d7Copy full SHA for 78b49d7
src/common/tests.rs
@@ -441,3 +441,24 @@ fn test_large_registered_label_with_private_decode_fail() {
441
expect_err(result, err_msg);
442
}
443
444
+
445
+#[test]
446
+fn test_as_cbor_value() {
447
+ let cases = [
448
+ Value::Null,
449
+ Value::Bool(true),
450
+ Value::Bool(false),
451
+ Value::from(128),
452
+ Value::from(-1),
453
+ Value::Bytes(vec![1, 2]),
454
+ Value::Text("string".to_owned()),
455
+ Value::Array(vec![Value::from(0)]),
456
+ Value::Map(vec![]),
457
+ Value::Tag(1, Box::new(Value::from(0))),
458
+ Value::Float(1.054571817),
459
+ ];
460
+ for val in cases {
461
+ assert_eq!(val, Value::from_cbor_value(val.clone()).unwrap());
462
+ assert_eq!(val, val.clone().to_cbor_value().unwrap());
463
+ }
464
+}
0 commit comments