Debian Codegraph @

tests/oid.rs

raw symbols SCIP
1 //! Tests for `ObjectIdentifier`.
2
3 // TODO(tarcieri): test full set of OID encoding constraints specified here:
4 // <https://misc.daniel-marschall.de/asn.1/oid_facts.html>
5
6 use const_oidrust-analyzer cargo const-oid 0.10.2 crate/::{Errorrust-analyzer cargo const-oid 0.10.2 error/Error#, ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#};
7 use hex_literalrust-analyzer cargo hex-literal 1.1.0 crate/::hexrust-analyzer cargo hex-literal 1.1.0 hex!;
8 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#;
9
10 /// Example OID value with a root arc of `0` (and large arc).
11 const EXAMPLE_OID_0_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0_STR.: &str = "0.9.2342.19200300.100.1.1";
12 const EXAMPLE_OID_0_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0_BER.: &[u8] = &hexrust-analyzer cargo hex-literal 1.1.0 hex!!("0992268993F22C640101");
13 const EXAMPLE_OID_0rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0.: ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier# = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::new_unwraprust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new_unwrap().(EXAMPLE_OID_0_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0_STR.);
14
15 /// Example OID value with a root arc of `1`.
16 const EXAMPLE_OID_1_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1_STR.: &str = "1.2.840.10045.2.1";
17 const EXAMPLE_OID_1_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1_BER.: &[u8] = &hexrust-analyzer cargo hex-literal 1.1.0 hex!!("2A8648CE3D0201");
18 const EXAMPLE_OID_1rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1.: ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier# = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::new_unwraprust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new_unwrap().(EXAMPLE_OID_1_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1_STR.);
19
20 /// Example OID value with a root arc of `2`.
21 const EXAMPLE_OID_2_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2_STR.: &str = "2.16.840.1.101.3.4.1.42";
22 const EXAMPLE_OID_2_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2_BER.: &[u8] = &hexrust-analyzer cargo hex-literal 1.1.0 hex!!("60864801650304012A");
23 const EXAMPLE_OID_2rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2.: ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier# = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::new_unwraprust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new_unwrap().(EXAMPLE_OID_2_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2_STR.);
24
25 /// Example OID value with a large arc
26 const EXAMPLE_OID_LARGE_ARC_0_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_0_STR.: &str = "1.2.16384";
27 const EXAMPLE_OID_LARGE_ARC_0_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_0_BER.: &[u8] = &hexrust-analyzer cargo hex-literal 1.1.0 hex!!("2A818000");
28 const EXAMPLE_OID_LARGE_ARC_0rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_0.: ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier# =
29 ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::new_unwraprust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new_unwrap().(craterust-analyzer cargo const-oid 0.10.2 crate/::EXAMPLE_OID_LARGE_ARC_0_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_0_STR.);
30
31 /// Example OID value with a large arc
32 const EXAMPLE_OID_LARGE_ARC_1_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_1_STR.: &str = "1.1.1.60817410.1";
33 const EXAMPLE_OID_LARGE_ARC_1_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_1_BER.: &[u8] = &hexrust-analyzer cargo hex-literal 1.1.0 hex!!("29019D80800201");
34 const EXAMPLE_OID_LARGE_ARC_1rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_1.: ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier# =
35 ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::new_unwraprust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new_unwrap().(EXAMPLE_OID_LARGE_ARC_1_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_1_STR.);
36
37 /// Example OID value with a large arc (namely `u32::MAX`, the edge case)
38 const EXAMPLE_OID_LARGE_ARC_2_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_2_STR.: &str = "1.2.4294967295";
39 const EXAMPLE_OID_LARGE_ARC_2_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_2_BER.: &[u8] = &hexrust-analyzer cargo hex-literal 1.1.0 hex!!("2A8FFFFFFF7F");
40 const EXAMPLE_OID_LARGE_ARC_2rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_2.: ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier# =
41 ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::new_unwraprust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new_unwrap().(craterust-analyzer cargo const-oid 0.10.2 crate/::EXAMPLE_OID_LARGE_ARC_2_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_2_STR.);
42
43 /// Create an OID from a string.
44 pub fn oidrust-analyzer cargo const-oid 0.10.2 oid().(s: &str) -> ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier# {
45 ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::newrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new().(s).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
46 }
47
48 /// 0.9.2342.19200300.100.1.1
49 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
50 fn from_bytes_oid_0rust-analyzer cargo const-oid 0.10.2 from_bytes_oid_0().() {
51 let oid = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_bytesrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_bytes().(EXAMPLE_OID_0_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0_BER.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
52 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid, EXAMPLE_OID_0rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0.);
53 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 0);
54 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 9);
55 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2342);
56 }
57
58 /// 1.2.840.10045.2.1
59 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
60 fn from_bytes_oid_1rust-analyzer cargo const-oid 0.10.2 from_bytes_oid_1().() {
61 let oid = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_bytesrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_bytes().(EXAMPLE_OID_1_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1_BER.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
62 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid, EXAMPLE_OID_1rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1.);
63 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
64 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2);
65 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 840);
66 }
67
68 /// 2.16.840.1.101.3.4.1.42
69 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
70 fn from_bytes_oid_2rust-analyzer cargo const-oid 0.10.2 from_bytes_oid_2().() {
71 let oid = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_bytesrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_bytes().(EXAMPLE_OID_2_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2_BER.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
72 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid, EXAMPLE_OID_2rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2.);
73 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2);
74 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 16);
75 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 840);
76 }
77
78 /// 1.2.16384
79 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
80 fn from_bytes_oid_largearc_0rust-analyzer cargo const-oid 0.10.2 from_bytes_oid_largearc_0().() {
81 let oid = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_bytesrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_bytes().(EXAMPLE_OID_LARGE_ARC_0_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_0_BER.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
82 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid, EXAMPLE_OID_LARGE_ARC_0rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_0.);
83 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
84 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2);
85 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 16384);
86 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(3), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
87 }
88
89 /// 1.1.1.60817410.1
90 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
91 fn from_bytes_oid_largearc_1rust-analyzer cargo const-oid 0.10.2 from_bytes_oid_largearc_1().() {
92 let oid = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_bytesrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_bytes().(EXAMPLE_OID_LARGE_ARC_1_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_1_BER.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
93 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid, EXAMPLE_OID_LARGE_ARC_1rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_1.);
94 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
95 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
96 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
97 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(3).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 60817410);
98 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(4).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
99 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(5), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
100 }
101
102 /// 1.2.4294967295
103 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
104 fn from_bytes_oid_largearc_2rust-analyzer cargo const-oid 0.10.2 from_bytes_oid_largearc_2().() {
105 let oid = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_bytesrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_bytes().(EXAMPLE_OID_LARGE_ARC_2_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_2_BER.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
106 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid, EXAMPLE_OID_LARGE_ARC_2rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_2.);
107 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
108 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2);
109 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 4294967295);
110 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(3), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
111
112 // Empty
113 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_bytesrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_bytes().(&[]), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo const-oid 0.10.2 error/Error#::Emptyrust-analyzer cargo const-oid 0.10.2 error/Error#Empty#));
114 }
115
116 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
117 fn from_strrust-analyzer cargo const-oid 0.10.2 from_str().() {
118 let oid0 = EXAMPLE_OID_0_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0_STR..parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
119 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid0.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 0);
120 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid0.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 9);
121 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid0, EXAMPLE_OID_0rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0.);
122
123 let oid1 = EXAMPLE_OID_1_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1_STR..parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
124 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid1.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
125 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid1.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2);
126 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid1, EXAMPLE_OID_1rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1.);
127
128 let oid2 = EXAMPLE_OID_2_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2_STR..parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
129 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid2.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2);
130 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid2.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 16);
131 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid2, EXAMPLE_OID_2rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2.);
132
133 let oid_largearc0 = EXAMPLE_OID_LARGE_ARC_0_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_0_STR.
134 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#>()
135 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
136 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc0.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
137 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc0.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2);
138 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc0.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 16384);
139 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc0, EXAMPLE_OID_LARGE_ARC_0rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_0.);
140
141 let oid_largearc1 = EXAMPLE_OID_LARGE_ARC_1_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_1_STR.
142 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#>()
143 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
144 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc1.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
145 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc1.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
146 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc1.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
147 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc1.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(3).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 60817410);
148 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc1.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(4).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
149 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc1, EXAMPLE_OID_LARGE_ARC_1rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_1.);
150
151 let oid_largearc2 = EXAMPLE_OID_LARGE_ARC_2_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_2_STR.
152 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#>()
153 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
154 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc2.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
155 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc2.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2);
156 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc2.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 4294967295);
157 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid_largearc2, EXAMPLE_OID_LARGE_ARC_2rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_2.);
158
159 // Truncated
160 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
161 "1.2.840.10045.2.".parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#>(),
162 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo const-oid 0.10.2 error/Error#::TrailingDotrust-analyzer cargo const-oid 0.10.2 error/Error#TrailingDot#)
163 );
164
165 // Invalid first arc
166 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
167 "3.2.840.10045.2.1".parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#>(),
168 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo const-oid 0.10.2 error/Error#::ArcInvalidrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid# { arcrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid#arc.: 3 })
169 );
170
171 // Invalid second arc
172 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
173 "1.40.840.10045.2.1".parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#>(),
174 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo const-oid 0.10.2 error/Error#::ArcInvalidrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid# { arcrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid#arc.: 40 })
175 );
176 }
177
178 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
179 fn displayrust-analyzer cargo const-oid 0.10.2 display().() {
180 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(EXAMPLE_OID_0rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), EXAMPLE_OID_0_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0_STR.);
181 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(EXAMPLE_OID_1rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), EXAMPLE_OID_1_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1_STR.);
182 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(EXAMPLE_OID_2rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), EXAMPLE_OID_2_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2_STR.);
183 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
184 EXAMPLE_OID_LARGE_ARC_0rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_0..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
185 EXAMPLE_OID_LARGE_ARC_0_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_0_STR.
186 );
187 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
188 EXAMPLE_OID_LARGE_ARC_1rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_1..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
189 EXAMPLE_OID_LARGE_ARC_1_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_1_STR.
190 );
191 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
192 EXAMPLE_OID_LARGE_ARC_2rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_2..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
193 EXAMPLE_OID_LARGE_ARC_2_STRrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_LARGE_ARC_2_STR.
194 );
195 }
196
197 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
198 fn try_from_u32_slicerust-analyzer cargo const-oid 0.10.2 try_from_u32_slice().() {
199 let oid1 = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_arcsrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_arcs().([1, 2, 840, 10045, 2, 1]).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
200 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid1.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1);
201 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid1.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2);
202 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(EXAMPLE_OID_1rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1., oid1);
203
204 let oid2 = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_arcsrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_arcs().([2, 16, 840, 1, 101, 3, 4, 1, 42]).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
205 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid2.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2);
206 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(oid2.arcrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]arc().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 16);
207 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(EXAMPLE_OID_2rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2., oid2);
208
209 // Invalid first arc
210 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
211 ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_arcsrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_arcs().([3, 2, 840, 10045, 3, 1, 7]),
212 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo const-oid 0.10.2 error/Error#::ArcInvalidrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid# { arcrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid#arc.: 3 })
213 );
214
215 // Invalid second arc
216 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
217 ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::from_arcsrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]from_arcs().([1, 40, 840, 10045, 3, 1, 7]),
218 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo const-oid 0.10.2 error/Error#::ArcInvalidrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid# { arcrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid#arc.: 40 })
219 );
220 }
221
222 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
223 fn as_bytesrust-analyzer cargo const-oid 0.10.2 as_bytes().() {
224 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(EXAMPLE_OID_1rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1..as_bytesrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]as_bytes().(), EXAMPLE_OID_1_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_1_BER.);
225 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(EXAMPLE_OID_2rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2..as_bytesrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]as_bytes().(), EXAMPLE_OID_2_BERrust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_2_BER.);
226 }
227
228 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
229 fn as_oid_refrust-analyzer cargo const-oid 0.10.2 as_oid_ref().() {
230 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
231 EXAMPLE_OID_0rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0..as_bytesrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]as_bytes().(),
232 EXAMPLE_OID_0rust-analyzer cargo const-oid 0.10.2 EXAMPLE_OID_0..as_oid_refrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]as_oid_ref().().as_bytesrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifierRef]as_bytes().()
233 );
234 }
235
236 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
237 fn parse_emptyrust-analyzer cargo const-oid 0.10.2 parse_empty().() {
238 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::newrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new().(""), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo const-oid 0.10.2 error/Error#::Emptyrust-analyzer cargo const-oid 0.10.2 error/Error#Empty#));
239 }
240
241 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
242 fn parse_invalid_first_arcrust-analyzer cargo const-oid 0.10.2 parse_invalid_first_arc().() {
243 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
244 ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::newrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new().("3.2.840.10045.3.1.7"),
245 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo const-oid 0.10.2 error/Error#::ArcInvalidrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid# { arcrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid#arc.: 3 })
246 );
247 }
248
249 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
250 fn parse_invalid_second_arcrust-analyzer cargo const-oid 0.10.2 parse_invalid_second_arc().() {
251 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
252 ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::newrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new().("1.40.840.10045.3.1.7"),
253 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo const-oid 0.10.2 error/Error#::ArcInvalidrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid# { arcrust-analyzer cargo const-oid 0.10.2 error/Error#ArcInvalid#arc.: 40 })
254 );
255 }
256
257 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
258 fn parse_invalid_repeat_dotsrust-analyzer cargo const-oid 0.10.2 parse_invalid_repeat_dots().() {
259 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::newrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new().("1.2..3.4"), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo const-oid 0.10.2 error/Error#::RepeatedDotrust-analyzer cargo const-oid 0.10.2 error/Error#RepeatedDot#))
260 }
261
262 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
263 fn parentrust-analyzer cargo const-oid 0.10.2 parent().() {
264 let child = oidrust-analyzer cargo const-oid 0.10.2 oid().("1.2.3.4");
265 let parent = child.parentrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]parent().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
266 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parent, oidrust-analyzer cargo const-oid 0.10.2 oid().("1.2.3"));
267
268 let parent = parent.parentrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]parent().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
269 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parent, oidrust-analyzer cargo const-oid 0.10.2 oid().("1.2"));
270 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parent.parentrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]parent().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
271 }
272
273 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
274 fn push_arcrust-analyzer cargo const-oid 0.10.2 push_arc().() {
275 let parent = oidrust-analyzer cargo const-oid 0.10.2 oid().("1.2.3");
276 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parent.push_arcrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]push_arc().(4).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), oidrust-analyzer cargo const-oid 0.10.2 oid().("1.2.3.4"));
277 }
278
279 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
280 fn starts_withrust-analyzer cargo const-oid 0.10.2 starts_with().() {
281 let child = ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#::newrust-analyzer cargo const-oid 0.10.2 impl#[ObjectIdentifier]new().("1.2.3.4.5").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
282 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(child.starts_withrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]starts_with().(oidrust-analyzer cargo const-oid 0.10.2 oid().("1.2.3.4.5")));
283 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(child.starts_withrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]starts_with().(oidrust-analyzer cargo const-oid 0.10.2 oid().("1.2.3.4")));
284 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(child.starts_withrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]starts_with().(oidrust-analyzer cargo const-oid 0.10.2 oid().("1.2.3")));
285
286 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().child.starts_withrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]starts_with().(oidrust-analyzer cargo const-oid 0.10.2 oid().("1.2.4")));
287 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().child.starts_withrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]starts_with().(oidrust-analyzer cargo const-oid 0.10.2 oid().("2.2.3")));
288 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().child.starts_withrust-analyzer cargo const-oid 0.10.2 impl#[`ObjectIdentifier<MAX_SIZE>`]starts_with().(oidrust-analyzer cargo const-oid 0.10.2 oid().("1.2.3.4.5.6")));
289 }