|
4 | 4 | // file that was distributed with this source code. |
5 | 5 | // spell-checker:ignore (words) asdf algo algos asha mgmt xffname hexa GFYEQ HYQK Yqxb dont checkfile |
6 | 6 |
|
| 7 | +use rstest::rstest; |
| 8 | + |
7 | 9 | use uutests::at_and_ucmd; |
8 | 10 | use uutests::new_ucmd; |
9 | 11 | use uutests::util::TestScenario; |
@@ -3098,3 +3100,129 @@ fn test_check_checkfile_with_io_error() { |
3098 | 3100 | .stderr_contains("/proc/self/mem: read error") |
3099 | 3101 | .no_stdout(); |
3100 | 3102 | } |
| 3103 | + |
| 3104 | +#[rstest] |
| 3105 | +#[case::default_length( |
| 3106 | + &[], |
| 3107 | + "ac8549b2861a151896ab721bd29d7a20c1a3d1f75b31266f786f20d963fb0fdf" |
| 3108 | +)] |
| 3109 | +#[case::pass_default_length( |
| 3110 | + &["-l", "256"], |
| 3111 | + "ac8549b2861a151896ab721bd29d7a20c1a3d1f75b31266f786f20d963fb0fdf" |
| 3112 | +)] |
| 3113 | +#[case::smaller_length( |
| 3114 | + &["-l", "128"], |
| 3115 | + "ac8549b2861a151896ab721bd29d7a20" |
| 3116 | +)] |
| 3117 | +#[case::bigger_length( |
| 3118 | + &["-l", "264"], |
| 3119 | + "ac8549b2861a151896ab721bd29d7a20c1a3d1f75b31266f786f20d963fb0fdfc2" |
| 3120 | +)] |
| 3121 | +#[case::length_0( |
| 3122 | + &["-l", "0"], |
| 3123 | + "ac8549b2861a151896ab721bd29d7a20c1a3d1f75b31266f786f20d963fb0fdf" |
| 3124 | +)] |
| 3125 | +#[case::length_1( |
| 3126 | + &["-l", "1"], |
| 3127 | + "00" |
| 3128 | +)] |
| 3129 | +#[case::length_2( |
| 3130 | + &["-l", "2"], |
| 3131 | + "00" |
| 3132 | +)] |
| 3133 | +#[case::length_3( |
| 3134 | + &["-l", "3"], |
| 3135 | + "04" |
| 3136 | +)] |
| 3137 | +#[case::length_4( |
| 3138 | + &["-l", "4"], |
| 3139 | + "0c" |
| 3140 | +)] |
| 3141 | +#[case::length_5( |
| 3142 | + &["-l", "5"], |
| 3143 | + "0c" |
| 3144 | +)] |
| 3145 | +#[case::length_6( |
| 3146 | + &["-l", "6"], |
| 3147 | + "2c" |
| 3148 | +)] |
| 3149 | +#[case::length_7( |
| 3150 | + &["-l", "7"], |
| 3151 | + "2c" |
| 3152 | +)] |
| 3153 | +#[case::length_8( |
| 3154 | + &["-l", "8"], |
| 3155 | + "ac" |
| 3156 | +)] |
| 3157 | +fn test_shake128(#[case] args: &[&str], #[case] expected: &str) { |
| 3158 | + new_ucmd!() |
| 3159 | + .arg("-a") |
| 3160 | + .arg("shake128") |
| 3161 | + .args(args) |
| 3162 | + .pipe_in("xxx") |
| 3163 | + .succeeds() |
| 3164 | + .stdout_only(format!("SHAKE128 (-) = {expected}\n")); |
| 3165 | +} |
| 3166 | + |
| 3167 | +#[rstest] |
| 3168 | +#[case::default_length( |
| 3169 | + &[], |
| 3170 | + "2fa631503c3ea5fe85131dbfa24805185474740e6dcb5f2a64f69d932bcb55f7b24958f3e3c4cc0e71f1fe6f054cd3fb28b9efb62b4f8f3fbe6d50d90f5c6eba" |
| 3171 | +)] |
| 3172 | +#[case::pass_default_length( |
| 3173 | + &["-l", "512"], |
| 3174 | + "2fa631503c3ea5fe85131dbfa24805185474740e6dcb5f2a64f69d932bcb55f7b24958f3e3c4cc0e71f1fe6f054cd3fb28b9efb62b4f8f3fbe6d50d90f5c6eba" |
| 3175 | +)] |
| 3176 | +#[case::smaller_length( |
| 3177 | + &["-l", "128"], |
| 3178 | + "2fa631503c3ea5fe85131dbfa2480518" |
| 3179 | +)] |
| 3180 | +#[case::bigger_length( |
| 3181 | + &["-l", "1024"], |
| 3182 | + "2fa631503c3ea5fe85131dbfa24805185474740e6dcb5f2a64f69d932bcb55f7b24958f3e3c4cc0e71f1fe6f054cd3fb28b9efb62b4f8f3fbe6d50d90f5c6eba18783d25f8b36d92b8607f016352b5c405945a7859a8339201728f680647324d1b8ea93a01d2ef965dadf4a1bee3ff044ed2b4bd95e4311f5e3f2cd5bae0b7c6" |
| 3183 | +)] |
| 3184 | +#[case::length_0( |
| 3185 | + &["-l", "0"], |
| 3186 | + "2fa631503c3ea5fe85131dbfa24805185474740e6dcb5f2a64f69d932bcb55f7b24958f3e3c4cc0e71f1fe6f054cd3fb28b9efb62b4f8f3fbe6d50d90f5c6eba" |
| 3187 | +)] |
| 3188 | +#[case::length_1( |
| 3189 | + &["-l", "1"], |
| 3190 | + "01" |
| 3191 | +)] |
| 3192 | +#[case::length_2( |
| 3193 | + &["-l", "2"], |
| 3194 | + "03" |
| 3195 | +)] |
| 3196 | +#[case::length_3( |
| 3197 | + &["-l", "3"], |
| 3198 | + "07" |
| 3199 | +)] |
| 3200 | +#[case::length_4( |
| 3201 | + &["-l", "4"], |
| 3202 | + "0f" |
| 3203 | +)] |
| 3204 | +#[case::length_5( |
| 3205 | + &["-l", "5"], |
| 3206 | + "0f" |
| 3207 | +)] |
| 3208 | +#[case::length_6( |
| 3209 | + &["-l", "6"], |
| 3210 | + "2f" |
| 3211 | +)] |
| 3212 | +#[case::length_7( |
| 3213 | + &["-l", "7"], |
| 3214 | + "2f" |
| 3215 | +)] |
| 3216 | +#[case::length_8( |
| 3217 | + &["-l", "8"], |
| 3218 | + "2f" |
| 3219 | +)] |
| 3220 | +fn test_shake256(#[case] args: &[&str], #[case] expected: &str) { |
| 3221 | + new_ucmd!() |
| 3222 | + .arg("-a") |
| 3223 | + .arg("shake256") |
| 3224 | + .args(args) |
| 3225 | + .pipe_in("xxx") |
| 3226 | + .succeeds() |
| 3227 | + .stdout_only(format!("SHAKE256 (-) = {expected}\n")); |
| 3228 | +} |
0 commit comments