@@ -359,22 +359,25 @@ impl<F: Field> Iterator for RootIter<F> {
359359
360360#[ cfg( test) ]
361361mod tests {
362+ use Fe32 as F ;
363+
362364 use super :: * ;
363365 use crate :: { Fe1024 , Fe32 } ;
364366
365367 #[ test]
366368 #[ cfg( feature = "alloc" ) ]
367369 fn roots ( ) {
368- let bip93_poly: Polynomial < Fe32 > = {
369- use Fe32 as F ;
370- [ F :: S , F :: S , F :: C , F :: M , F :: L , F :: E , F :: E , F :: E , F :: Q , F :: G , F :: _3, F :: M , F :: E , F :: P ]
371- }
372- . iter ( )
373- . copied ( )
374- . collect ( ) ;
370+ #[ rustfmt:: skip]
371+ let mut bip93_poly = Polynomial :: with_monic_leading_term (
372+ & [ F :: E , F :: M , F :: _3, F :: G , F :: Q , F :: E , F :: E , F :: E , F :: L , F :: M , F :: C , F :: S , F :: S ]
373+ ) ;
375374
375+ assert_eq ! ( bip93_poly. leading_term( ) , F :: P ) ;
376+ assert ! ( !bip93_poly. zero_is_root( ) ) ;
376377 assert_eq ! ( bip93_poly. degree( ) , 13 ) ;
377378
379+ bip93_poly. zero_pad_up_to ( 1000 ) ; // should have no visible effect
380+
378381 let ( elem, order, root_indices) = bip93_poly. bch_generator_primitive_element :: < Fe1024 > ( ) ;
379382 // Basically, only the order and the length of the `root_indices` range are
380383 // guaranteed to be consistent across runs. There will be two possible ranges,
@@ -422,18 +425,15 @@ mod tests {
422425 }
423426
424427 #[ test]
425- #[ cfg( not( feature = "alloc" ) ) ]
426- fn roots ( ) {
428+ fn roots_bech32 ( ) {
427429 // Exactly the same test as above, but for bech32
428- let bech32_poly: Polynomial < Fe32 > = {
429- use Fe32 as F ;
430- [ F :: J , F :: A , F :: _4, F :: _5, F :: K , F :: A , F :: P ]
431- }
432- . iter ( )
433- . copied ( )
434- . collect ( ) ;
430+ let bech32_poly =
431+ Polynomial :: with_monic_leading_term ( & [ F :: A , F :: K , F :: _5, F :: _4, F :: A , F :: J ] ) ;
435432
436- assert_eq ! ( bech32_poly. degree( ) , 6 ) ;
433+ assert_eq ! (
434+ bech32_poly. iter( ) . copied( ) . collect:: <Vec <_>>( ) ,
435+ [ F :: J , F :: A , F :: _4, F :: _5, F :: K , F :: A , F :: P ] ,
436+ ) ;
437437
438438 let ( elem, order, root_indices) = bech32_poly. bch_generator_primitive_element :: < Fe1024 > ( ) ;
439439 // As above, only the order and the length of the `root_indices` range are
0 commit comments