Debian Codegraph @

tests/test_debugid.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::{align_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/align_of()., size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().};
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#;
3
4 use debugidrust-analyzer cargo debugid 0.8.0 crate/::DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#;
5 use uuidrust-analyzer cargo uuid 1.25.0 crate/::Uuidrust-analyzer cargo uuid 1.25.0 Uuid#;
6
7 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
8 fn test_is_nilrust-analyzer cargo debugid 0.8.0 test_is_nil().() {
9 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::defaultrust-analyzer cargo debugid 0.8.0 impl#[DebugId][Default]default().().is_nilrust-analyzer cargo debugid 0.8.0 impl#[DebugId]is_nil().());
10 }
11
12 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
13 fn test_parse_zerorust-analyzer cargo debugid 0.8.0 test_parse_zero().() {
14 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
15 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
16 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
17 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
18 0,
19 )
20 );
21 }
22
23 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
24 fn test_parse_shortrust-analyzer cargo debugid 0.8.0 test_parse_short().() {
25 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
26 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75-a").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
27 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
28 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
29 0xa,
30 )
31 );
32 }
33
34 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
35 fn test_parse_longrust-analyzer cargo debugid 0.8.0 test_parse_long().() {
36 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
37 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75-feedface").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
38 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
39 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
40 0xfeed_face,
41 )
42 );
43 }
44
45 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
46 fn test_parse_compactrust-analyzer cargo debugid 0.8.0 test_parse_compact().() {
47 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
48 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("dfb8e43af2423d73a453aeb6a777ef75feedface").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
49 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
50 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
51 0xfeed_face,
52 )
53 );
54 }
55
56 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
57 fn test_parse_upperrust-analyzer cargo debugid 0.8.0 test_parse_upper().() {
58 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
59 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("DFB8E43A-F242-3D73-A453-AEB6A777EF75-FEEDFACE").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
60 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
61 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
62 0xfeed_face,
63 )
64 );
65 }
66
67 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
68 fn test_parse_ignores_tailrust-analyzer cargo debugid 0.8.0 test_parse_ignores_tail().() {
69 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
70 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75-feedface-1-2-3").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
71 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
72 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
73 0xfeed_face,
74 )
75 );
76 }
77
78 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
79 fn test_to_string_zerorust-analyzer cargo debugid 0.8.0 test_to_string_zero().() {
80 let id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
81 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
82 0,
83 );
84
85 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(id.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), "dfb8e43a-f242-3d73-a453-aeb6a777ef75");
86 }
87
88 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
89 fn test_to_string_shortrust-analyzer cargo debugid 0.8.0 test_to_string_short().() {
90 let id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
91 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
92 10,
93 );
94
95 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(id.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), "dfb8e43a-f242-3d73-a453-aeb6a777ef75-a");
96 }
97
98 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
99 fn test_to_string_longrust-analyzer cargo debugid 0.8.0 test_to_string_long().() {
100 let id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
101 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
102 0xfeed_face,
103 );
104
105 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
106 id.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
107 "dfb8e43a-f242-3d73-a453-aeb6a777ef75-feedface"
108 );
109 }
110
111 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
112 fn test_parse_error_shortrust-analyzer cargo debugid 0.8.0 test_parse_error_short().() {
113 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef7").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
114 }
115
116 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
117 fn test_parse_error_trailing_dashrust-analyzer cargo debugid 0.8.0 test_parse_error_trailing_dash().() {
118 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75-").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
119 }
120
121 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
122 fn test_parse_error_unicoderust-analyzer cargo debugid 0.8.0 test_parse_error_unicode().() {
123 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("아이쿱 조합원 앱카드").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
124 }
125
126 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
127 fn test_from_guid_agerust-analyzer cargo debugid 0.8.0 test_from_guid_age().() {
128 let guid = [
129 0x98, 0xd1, 0xef, 0xe8, 0x6e, 0xf8, 0xfe, 0x45, 0x9d, 0xdb, 0xe1, 0x13, 0x82, 0xb5, 0xd1,
130 0xc9,
131 ];
132
133 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
134 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_guid_agerust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_guid_age().(&guid[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., 1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
135 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("e8efd198-f86e-45fe-9ddb-e11382b5d1c9-1").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
136 )
137 }
138
139 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
140 fn test_parse_breakpad_zerorust-analyzer cargo debugid 0.8.0 test_parse_breakpad_zero().() {
141 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
142 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_breakpad().("DFB8E43AF2423D73A453AEB6A777EF750").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
143 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
144 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("DFB8E43AF2423D73A453AEB6A777EF75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
145 0,
146 )
147 );
148 }
149
150 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
151 fn test_parse_breakpad_shortrust-analyzer cargo debugid 0.8.0 test_parse_breakpad_short().() {
152 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
153 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_breakpad().("DFB8E43AF2423D73A453AEB6A777EF75a").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
154 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
155 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("DFB8E43AF2423D73A453AEB6A777EF75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
156 10,
157 )
158 );
159 }
160
161 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
162 fn test_parse_breakpad_longrust-analyzer cargo debugid 0.8.0 test_parse_breakpad_long().() {
163 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
164 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_breakpad().("DFB8E43AF2423D73A453AEB6A777EF75feedface").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
165 DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
166 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("DFB8E43AF2423D73A453AEB6A777EF75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
167 0xfeed_face,
168 )
169 );
170 }
171
172 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
173 fn test_parse_breakpad_error_tailrust-analyzer cargo debugid 0.8.0 test_parse_breakpad_error_tail().() {
174 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_breakpad().("DFB8E43AF2423D73A453AEB6A777EF75feedface123").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
175 }
176
177 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
178 fn test_parse_breakpad_error_missing_agerust-analyzer cargo debugid 0.8.0 test_parse_breakpad_error_missing_age().() {
179 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_breakpad().("DFB8E43AF2423D73A453AEB6A777EF75").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
180 }
181
182 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
183 fn test_parse_breakpad_error_shortrust-analyzer cargo debugid 0.8.0 test_parse_breakpad_error_short().() {
184 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_breakpad().("DFB8E43AF2423D73A453AEB6A777EF7").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
185 }
186
187 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
188 fn test_parse_breakpad_error_dashesrust-analyzer cargo debugid 0.8.0 test_parse_breakpad_error_dashes().() {
189 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_breakpad().("e8efd198-f86e-45fe-9ddb-e11382b5d1c9-1").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
190 }
191
192 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
193 fn test_to_string_breakpad_zerorust-analyzer cargo debugid 0.8.0 test_to_string_breakpad_zero().() {
194 let id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
195 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("DFB8E43AF2423D73A453AEB6A777EF75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
196 0,
197 );
198
199 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
200 id.breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]breakpad().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
201 "DFB8E43AF2423D73A453AEB6A777EF750"
202 );
203 }
204
205 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
206 fn test_to_string_breakpad_shortrust-analyzer cargo debugid 0.8.0 test_to_string_breakpad_short().() {
207 let id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
208 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("DFB8E43AF2423D73A453AEB6A777EF75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
209 10,
210 );
211
212 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
213 id.breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]breakpad().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
214 "DFB8E43AF2423D73A453AEB6A777EF75a"
215 );
216 }
217
218 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
219 fn test_to_string_breakpad_longrust-analyzer cargo debugid 0.8.0 test_to_string_breakpad_long().() {
220 let id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
221 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("DFB8E43AF2423D73A453AEB6A777EF75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
222 0xfeed_face,
223 );
224
225 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
226 id.breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]breakpad().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
227 "DFB8E43AF2423D73A453AEB6A777EF75feedface"
228 );
229 }
230
231 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
232 fn test_debug_id_debugrust-analyzer cargo debugid 0.8.0 test_debug_id_debug().() {
233 let id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_partsrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_parts().(
234 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("DFB8E43AF2423D73A453AEB6A777EF75").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
235 10,
236 );
237
238 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
239 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", id),
240 "DebugId { uuid: \"dfb8e43a-f242-3d73-a453-aeb6a777ef75\", appendix: 10 }"
241 );
242 }
243
244 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
245 #[cfg(feature = "with_serde")]
246 fn test_serde_serialize() {
247 let id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_parts(
248 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_str("DFB8E43AF2423D73A453AEB6A777EF75").unwrap(),
249 10,
250 );
251
252 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
253 serde_json::to_string(&id).expect("could not serialize"),
254 "\"dfb8e43a-f242-3d73-a453-aeb6a777ef75-a\""
255 )
256 }
257
258 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
259 #[cfg(feature = "with_serde")]
260 fn test_serde_deserialize() {
261 let id: DebugIdrust-analyzer cargo debugid 0.8.0 DebugId# = serde_jsonrust-analyzer cargo serde_json 1.0.151 crate/::from_strrust-analyzer cargo serde_json 1.0.151 de/from_str().("\"dfb8e43a-f242-3d73-a453-aeb6a777ef75-a\"")
262 .expect("could not deserialize");
263
264 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
265 id,
266 DebugId::from_parts(
267 Uuid::parse_str("DFB8E43AF2423D73A453AEB6A777EF75").unwrap(),
268 10,
269 )
270 );
271 }
272
273 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
274 fn test_pdb20rust-analyzer cargo debugid 0.8.0 test_pdb20().() {
275 let timestamp: u32 = 0x418e89c3;
276 let age: u32 = 1;
277 let debug_id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_pdb20rust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_pdb20().(timestamp, age);
278
279 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(debug_id.is_pdb20rust-analyzer cargo debugid 0.8.0 impl#[DebugId]is_pdb20().());
280 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
281 debug_id.uuidrust-analyzer cargo debugid 0.8.0 impl#[DebugId]uuid().(),
282 Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::parse_strrust-analyzer cargo uuid 1.25.0 parser/impl#[Uuid]parse_str().("418e89c3-0000-0000-0000-000000000000").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
283 );
284 }
285
286 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
287 fn test_pdb20_formatrust-analyzer cargo debugid 0.8.0 test_pdb20_format().() {
288 let timestamp: u32 = 0x418e89c3;
289 let age: u32 = 1;
290 let debug_id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_pdb20rust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_pdb20().(timestamp, age);
291
292 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(debug_id.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), "418E89C3-1".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
293 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(debug_id.breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]breakpad().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), "418E89C31");
294 }
295
296 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
297 fn test_pdb20_parserust-analyzer cargo debugid 0.8.0 test_pdb20_parse().() {
298 let timestamp: u32 = 0x418e89c3;
299 let age: u32 = 1;
300 let debug_id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_pdb20rust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_pdb20().(timestamp, age);
301
302 let s = "418E89C3-1";
303 let parsed = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().(s).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
304 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parsed, debug_id);
305
306 let s = "418E89C31";
307 let parsed = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().(s).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
308 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parsed, debug_id);
309
310 let s = "418E89C31";
311 let parsed = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_breakpad().(s).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
312 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parsed, debug_id);
313
314 let s = "418E89C3-1";
315 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_breakpadrust-analyzer cargo debugid 0.8.0 impl#[DebugId]from_breakpad().(s).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
316 }
317
318 /// The version of `DebugId` up to 0.7.2.
319 #[repr(C, packed)]
320 struct OldDebugIdrust-analyzer cargo debugid 0.8.0 OldDebugId# {
321 uuidrust-analyzer cargo debugid 0.8.0 OldDebugId#uuid.: Uuidrust-analyzer cargo uuid 1.25.0 Uuid#,
322 appendixrust-analyzer cargo debugid 0.8.0 OldDebugId#appendix.: u32,
323 _paddingrust-analyzer cargo debugid 0.8.0 OldDebugId#_padding.: [u8; 12],
324 }
325
326 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
327 fn test_memrust-analyzer cargo debugid 0.8.0 test_mem().() {
328 // The size of this struct needs to be exactly aligned and can not change for backwards
329 // compatibility.
330 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<OldDebugIdrust-analyzer cargo debugid 0.8.0 OldDebugId#>(), 32);
331 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<OldDebugIdrust-analyzer cargo debugid 0.8.0 OldDebugId#>(), size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#>());
332 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(align_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/align_of().::<DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#>(), 1);
333 }
334
335 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
336 fn test_to_from_rawrust-analyzer cargo debugid 0.8.0 test_to_from_raw().() {
337 let debug_id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75-a").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
338
339 // Create &[u8] from DebugId.
340 let slice = &[debug_id];
341 let ptr = slice.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const u8;
342 let len = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(slice);
343 let buf: &[u8] = unsafe { stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/::from_raw_partsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_raw_parts().(ptr, len) };
344
345 // Copy bytes to new location.
346 let mut new_buf: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
347 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::copyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/copy/copy().(&mut stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(buf), &mut new_buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
348
349 // Create DebugId from &[u8].
350 let ptr = new_buf.as_ptrrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_ptr().() as *const DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#;
351 let new_debug_id = unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().ptr };
352
353 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().new_debug_id, debug_id);
354 }
355
356 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
357 fn test_from_old_rawrust-analyzer cargo debugid 0.8.0 test_from_old_raw().() {
358 // Ensures we can still read previous in-memory representations into the new format.
359 let debug_id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::from_strrust-analyzer cargo debugid 0.8.0 impl#[DebugId][FromStr]from_str().("dfb8e43a-f242-3d73-a453-aeb6a777ef75-a").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
360 let old_debug_id = OldDebugIdrust-analyzer cargo debugid 0.8.0 OldDebugId# {
361 uuidrust-analyzer cargo debugid 0.8.0 OldDebugId#uuid.: debug_id.uuidrust-analyzer cargo debugid 0.8.0 impl#[DebugId]uuid().(),
362 appendixrust-analyzer cargo debugid 0.8.0 OldDebugId#appendix.: debug_id.appendixrust-analyzer cargo debugid 0.8.0 impl#[DebugId]appendix().(),
363 _paddingrust-analyzer cargo debugid 0.8.0 OldDebugId#_padding.: [0; 12],
364 };
365
366 // Create &[u8] from OldDebugId.
367 let slice = &[old_debug_id];
368 let ptr = slice.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const u8;
369 let len = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(slice);
370 let buf: &[u8] = unsafe { stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/::from_raw_partsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_raw_parts().(ptr, len) };
371
372 // Copy bytes to new location.
373 let mut new_buf: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
374 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::copyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/copy/copy().(&mut stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(buf), &mut new_buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
375
376 // Create DebugId from &[u8].
377 let ptr = new_buf.as_ptrrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_ptr().() as *const DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#;
378 let new_debug_id = unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().ptr };
379
380 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().new_debug_id, debug_id);
381 }
382
383 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
384 fn test_defaultrust-analyzer cargo debugid 0.8.0 test_default().() {
385 let debug_id = DebugIdrust-analyzer cargo debugid 0.8.0 DebugId#::defaultrust-analyzer cargo debugid 0.8.0 impl#[DebugId][Default]default().();
386 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(debug_id.uuidrust-analyzer cargo debugid 0.8.0 impl#[DebugId]uuid().(), Uuidrust-analyzer cargo uuid 1.25.0 Uuid#::nilrust-analyzer cargo uuid 1.25.0 builder/impl#[Uuid]nil().());
387 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(debug_id.appendixrust-analyzer cargo debugid 0.8.0 impl#[DebugId]appendix().(), 0);
388 }