File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3221,3 +3221,57 @@ fn test_shake256(#[case] args: &[&str], #[case] expected: &str) {
32213221 . succeeds ( )
32223222 . stdout_only ( format ! ( "SHAKE256 (-) = {expected}\n " ) ) ;
32233223}
3224+
3225+ #[ rstest]
3226+ #[ case(
3227+ b"foo" ,
3228+ "04e0bb39f30b1a3feb89f536c93be15055482df748674b00d26e5a75777702e9"
3229+ ) ]
3230+ fn test_blake3b_no_length ( #[ case] input : & [ u8 ] , #[ case] expected : & str ) {
3231+ new_ucmd ! ( )
3232+ . arg ( "-a" )
3233+ . arg ( "blake3" )
3234+ . pipe_in ( input)
3235+ . succeeds ( )
3236+ . stdout_only ( format ! ( "BLAKE3-32 (-) = {expected}\n " ) ) ;
3237+ }
3238+
3239+ #[ rstest]
3240+ #[ case(
3241+ b"foo" ,
3242+ "04e0bb39f30b1a3feb89f536c93be15055482df748674b00d26e5a75777702e9" ,
3243+ 0
3244+ ) ]
3245+ #[ case(
3246+ b"foo" ,
3247+ "04e0bb39f30b1a3feb89f536c93be15055482df748674b00d26e5a75777702e9" ,
3248+ 32
3249+ ) ]
3250+ #[ case( b"foo" , "04e0bb39f3" , 5 ) ]
3251+ #[ case( b"foo" , "04e0" , 2 ) ]
3252+ #[ case( b"foo" , "04" , 1 ) ]
3253+ fn test_blake3b ( #[ case] input : & [ u8 ] , #[ case] expected : & str , #[ case] length : usize ) {
3254+ new_ucmd ! ( )
3255+ . arg ( "-a" )
3256+ . arg ( "blake3" )
3257+ . args ( & [ "-l" , & length. to_string ( ) ] )
3258+ . pipe_in ( input)
3259+ . succeeds ( )
3260+ . stdout_only ( format ! (
3261+ "BLAKE3-{} (-) = {expected}\n " ,
3262+ match length {
3263+ 0 => "32" . to_string( ) ,
3264+ i => i. to_string( ) ,
3265+ }
3266+ ) ) ;
3267+
3268+ // with --untagged
3269+ new_ucmd ! ( )
3270+ . arg ( "-a" )
3271+ . arg ( "blake3" )
3272+ . arg ( "--untagged" )
3273+ . args ( & [ "-l" , & length. to_string ( ) ] )
3274+ . pipe_in ( input)
3275+ . succeeds ( )
3276+ . stdout_only ( format ! ( "{expected} -\n " ) ) ;
3277+ }
You can’t perform that action at this time.
0 commit comments