File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -362,7 +362,12 @@ mod test {
362
362
assert_eq ! ( find_publisher_index( & comps, & comp. pub_) , Some ( idx) ) ;
363
363
} ) ;
364
364
365
- assert_eq ! ( find_publisher_index( & comps, & Pubkey :: new_unique( ) ) , None ) ;
365
+ let mut key_not_in_list = Pubkey :: new_unique ( ) ;
366
+ while comps. iter ( ) . any ( |comp| comp. pub_ == key_not_in_list) {
367
+ key_not_in_list = Pubkey :: new_unique ( ) ;
368
+ }
369
+
370
+ assert_eq ! ( find_publisher_index( & comps, & key_not_in_list) , None ) ;
366
371
}
367
372
368
373
/// Test the find_publisher_index method works with a sorted list of components.
@@ -374,6 +379,11 @@ mod test {
374
379
assert_eq ! ( find_publisher_index( & comps, & comp. pub_) , Some ( idx) ) ;
375
380
} ) ;
376
381
377
- assert_eq ! ( find_publisher_index( & comps, & Pubkey :: new_unique( ) ) , None ) ;
382
+ let mut key_not_in_list = Pubkey :: new_unique ( ) ;
383
+ while comps. iter ( ) . any ( |comp| comp. pub_ == key_not_in_list) {
384
+ key_not_in_list = Pubkey :: new_unique ( ) ;
385
+ }
386
+
387
+ assert_eq ! ( find_publisher_index( & comps, & key_not_in_list) , None ) ;
378
388
}
379
389
}
Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ fn test_add_publisher() {
199
199
// Make sure that publishers get sorted after adding the default publisher
200
200
{
201
201
let price_data = load_checked :: < PriceAccount > ( & price_account, PC_VERSION ) . unwrap ( ) ;
202
- println ! ( "{:?}" , price_data. comp_ . map ( |x| x . pub_ ) ) ;
202
+ assert ! ( price_data. num_ == PC_NUM_COMP ) ;
203
203
for i in 1 ..PC_NUM_COMP {
204
204
assert ! ( price_data. comp_[ i as usize ] . pub_ > price_data. comp_[ ( i - 1 ) as usize ] . pub_) ;
205
205
}
You can’t perform that action at this time.
0 commit comments