@@ -80,6 +80,7 @@ impl Iceoryx2Transport {
8080 "Unsupported UMessageType" ,
8181 ) )
8282 }
83+ /// Called by send(), register_listener() and unregister_listener()
8384 fn compute_service_name ( source : & UUri , sink : Option < & UUri > ) -> Result < String , UStatus > {
8485 let join_segments = |segments : Vec < String > | segments. join ( "/" ) ;
8586 // [impl->dsn~up-transport-iceoryx2-service-name~1]
@@ -120,7 +121,8 @@ impl Iceoryx2Transport {
120121 }
121122}
122123
123-
124+
125+
124126
125127#[ cfg( test) ]
126128mod tests {
@@ -141,21 +143,24 @@ mod tests {
141143 }
142144
143145 #[ test]
146+
144147 // [utest->dsn~up-transport-iceoryx2-service-name~1]
145148 fn test_notification_service_name ( ) {
146149 let source = test_uri ( "device1" , 0x0000 , 0x10AB , 0x03 , 0x80CD ) ;
147150 let sink = test_uri ( "device1" , 0x0000 , 0x30EF , 0x04 , 0x0000 ) ;
148151 let name = Iceoryx2Transport :: compute_service_name ( & source, Some ( & sink) ) . unwrap ( ) ;
152+
149153 assert_eq ! ( name, "up/device1/10AB/0/3/80CD/device1/30EF/0/4/0" ) ;
150154 }
151155
152156 #[ test]
157+
153158 // [utest->dsn~up-transport-iceoryx2-service-name~1]
154159 fn test_rpc_request_service_name ( ) {
155160 let sink = test_uri ( "device1" , 0x0004 , 0x03AB , 0x03 , 0x0000 ) ;
156161 let reply_to = test_uri ( "device1" , 0x0000 , 0x00CD , 0x04 , 0xB ) ;
157-
158- let name = Iceoryx2Transport :: compute_service_name ( & sink , Some ( & reply_to ) ) . unwrap ( ) ;
162+ let name = Iceoryx2Transport :: compute_service_name ( & sink , Some ( & reply_to ) ) . unwrap ( ) ;
163+
159164 assert_eq ! ( name, "up/device1/CD/0/4/B" ) ;
160165 }
161166
@@ -164,9 +169,8 @@ mod tests {
164169 fn test_rpc_response_service_name ( ) {
165170 let source = test_uri ( "device1" , 0x0000 , 0x00CD , 0x04 , 0xB ) ;
166171 let sink = test_uri ( "device1" , 0x0004 , 0x3AB , 0x3 , 0x0000 ) ;
167-
168-
169172 let name = Iceoryx2Transport :: compute_service_name ( & source, Some ( & sink) ) . unwrap ( ) ;
173+
170174 assert_eq ! ( name, "up/device1/CD/0/4/B/device1/3AB/4/3/0" ) ;
171175 }
172176
@@ -182,6 +186,7 @@ mod tests {
182186
183187 #[ test]
184188 // [utest->dsn~up-transport-iceoryx2-service-name~1]
189+
185190 fn test_fail_resource_id_error ( ) {
186191 let source = test_uri ( "device1" , 0x0000 , 0x00CD , 0x04 , 0x000 ) ;
187192 let sink = test_uri ( "device1" , 0x0004 , 0x3AB , 0x3 , 0x0000 ) ;
@@ -191,6 +196,7 @@ mod tests {
191196
192197 #[ test]
193198 // [utest->dsn~up-transport-iceoryx2-service-name~1]
199+
194200 fn test_fail_missing_source_error ( ) {
195201 let uuri = UUri :: new ( ) ;
196202 let sink = test_uri ( "device1" , 0x0004 , 0x3AB , 0x3 , 0x000 ) ;
0 commit comments