@@ -16,10 +16,12 @@ fn create_association(config: TransportConfig) -> Association {
16
16
17
17
#[ test]
18
18
fn test_create_forward_tsn_forward_one_abandoned ( ) -> Result < ( ) > {
19
- let mut a = Association :: default ( ) ;
19
+ let mut a = Association {
20
+ cumulative_tsn_ack_point : 9 ,
21
+ advanced_peer_tsn_ack_point : 10 ,
22
+ ..Default :: default ( )
23
+ } ;
20
24
21
- a. cumulative_tsn_ack_point = 9 ;
22
- a. advanced_peer_tsn_ack_point = 10 ;
23
25
a. inflight_queue . push_no_check ( ChunkPayloadData {
24
26
beginning_fragment : true ,
25
27
ending_fragment : true ,
@@ -44,10 +46,12 @@ fn test_create_forward_tsn_forward_one_abandoned() -> Result<()> {
44
46
45
47
#[ test]
46
48
fn test_create_forward_tsn_forward_two_abandoned_with_the_same_si ( ) -> Result < ( ) > {
47
- let mut a = Association :: default ( ) ;
49
+ let mut a = Association {
50
+ cumulative_tsn_ack_point : 9 ,
51
+ advanced_peer_tsn_ack_point : 12 ,
52
+ ..Default :: default ( )
53
+ } ;
48
54
49
- a. cumulative_tsn_ack_point = 9 ;
50
- a. advanced_peer_tsn_ack_point = 12 ;
51
55
a. inflight_queue . push_no_check ( ChunkPayloadData {
52
56
beginning_fragment : true ,
53
57
ending_fragment : true ,
@@ -99,7 +103,7 @@ fn test_create_forward_tsn_forward_two_abandoned_with_the_same_si() -> Result<()
99
103
assert_eq ! ( 1 , s. sequence, "ssn should be 1" ) ;
100
104
si2ok = true ;
101
105
}
102
- _ => assert ! ( false , "unexpected stream indentifier" ) ,
106
+ _ => panic ! ( "unexpected stream indentifier" ) ,
103
107
}
104
108
}
105
109
assert ! ( si1ok, "si=1 should be present" ) ;
@@ -110,9 +114,11 @@ fn test_create_forward_tsn_forward_two_abandoned_with_the_same_si() -> Result<()
110
114
111
115
#[ test]
112
116
fn test_handle_forward_tsn_forward_3unreceived_chunks ( ) -> Result < ( ) > {
113
- let mut a = Association :: default ( ) ;
117
+ let mut a = Association {
118
+ use_forward_tsn : true ,
119
+ ..Default :: default ( )
120
+ } ;
114
121
115
- a. use_forward_tsn = true ;
116
122
let prev_tsn = a. peer_last_tsn ;
117
123
118
124
let fwdtsn = ChunkForwardTsn {
@@ -144,9 +150,11 @@ fn test_handle_forward_tsn_forward_3unreceived_chunks() -> Result<()> {
144
150
145
151
#[ test]
146
152
fn test_handle_forward_tsn_forward_1for1_missing ( ) -> Result < ( ) > {
147
- let mut a = Association :: default ( ) ;
153
+ let mut a = Association {
154
+ use_forward_tsn : true ,
155
+ ..Default :: default ( )
156
+ } ;
148
157
149
- a. use_forward_tsn = true ;
150
158
let prev_tsn = a. peer_last_tsn ;
151
159
152
160
// this chunk is blocked by the missing chunk at tsn=1
@@ -192,7 +200,10 @@ fn test_handle_forward_tsn_forward_1for1_missing() -> Result<()> {
192
200
193
201
#[ test]
194
202
fn test_handle_forward_tsn_forward_1for2_missing ( ) -> Result < ( ) > {
195
- let mut a = Association :: default ( ) ;
203
+ let mut a = Association {
204
+ use_forward_tsn : true ,
205
+ ..Default :: default ( )
206
+ } ;
196
207
197
208
a. use_forward_tsn = true ;
198
209
let prev_tsn = a. peer_last_tsn ;
@@ -238,9 +249,11 @@ fn test_handle_forward_tsn_forward_1for2_missing() -> Result<()> {
238
249
239
250
#[ test]
240
251
fn test_handle_forward_tsn_dup_forward_tsn_chunk_should_generate_sack ( ) -> Result < ( ) > {
241
- let mut a = Association :: default ( ) ;
252
+ let mut a = Association {
253
+ use_forward_tsn : true ,
254
+ ..Default :: default ( )
255
+ } ;
242
256
243
- a. use_forward_tsn = true ;
244
257
let prev_tsn = a. peer_last_tsn ;
245
258
246
259
let fwdtsn = ChunkForwardTsn {
@@ -270,8 +283,7 @@ fn test_assoc_create_new_stream() -> Result<()> {
270
283
if let Some ( s) = a. create_stream ( i as u16 , true , PayloadProtocolIdentifier :: Unknown ) {
271
284
s. stream_identifier
272
285
} else {
273
- assert ! ( false , "{} should success" , i) ;
274
- 0
286
+ panic ! ( "{} should success" , i) ;
275
287
} ;
276
288
let result = a. streams . get ( & stream_identifier) ;
277
289
assert ! ( result. is_some( ) , "should be in a.streams map" ) ;
@@ -406,7 +418,7 @@ fn test_assoc_max_message_size_default() -> Result<()> {
406
418
"should be not Error::ErrOutboundPacketTooLarge"
407
419
) ;
408
420
} else {
409
- assert ! ( false , "should be error" ) ;
421
+ panic ! ( "should be error" ) ;
410
422
}
411
423
412
424
if let Err ( err) = s. write_sctp ( & p. slice ( ..65537 ) , ppi) {
@@ -416,7 +428,7 @@ fn test_assoc_max_message_size_default() -> Result<()> {
416
428
"should be Error::ErrOutboundPacketTooLarge"
417
429
) ;
418
430
} else {
419
- assert ! ( false , "should be error" ) ;
431
+ panic ! ( "should be error" ) ;
420
432
}
421
433
}
422
434
@@ -443,7 +455,7 @@ fn test_assoc_max_message_size_explicit() -> Result<()> {
443
455
"should be not Error::ErrOutboundPacketTooLarge"
444
456
) ;
445
457
} else {
446
- assert ! ( false , "should be error" ) ;
458
+ panic ! ( "should be error" ) ;
447
459
}
448
460
449
461
if let Err ( err) = s. write_sctp ( & p. slice ( ..30001 ) , ppi) {
@@ -453,7 +465,7 @@ fn test_assoc_max_message_size_explicit() -> Result<()> {
453
465
"should be Error::ErrOutboundPacketTooLarge"
454
466
) ;
455
467
} else {
456
- assert ! ( false , "should be error" ) ;
468
+ panic ! ( "should be error" ) ;
457
469
}
458
470
}
459
471
0 commit comments