@@ -199,22 +199,24 @@ impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> Iterator for PkIter<'a, Pk, Ctx>
199
199
}
200
200
}
201
201
202
- // Module is public since it export testcase generation which may be used in
203
- // dependent libraries for their own tasts based on Miniscript AST
202
+ /// Module is public since it export testcase generation which may be used in
203
+ /// dependent libraries for their own tasts based on Miniscript AST
204
204
#[ cfg( test) ]
205
205
pub mod test {
206
206
use bitcoin:: hashes:: { hash160, ripemd160, sha256, sha256d, Hash } ;
207
207
208
208
use super :: Miniscript ;
209
209
use crate :: miniscript:: context:: Segwitv0 ;
210
210
211
+ /// Test case.
211
212
pub type TestData = (
212
213
Miniscript < bitcoin:: PublicKey , Segwitv0 > ,
213
214
Vec < bitcoin:: PublicKey > ,
214
215
Vec < hash160:: Hash > ,
215
216
bool , // Indicates that the top-level contains public key or hashes
216
217
) ;
217
218
219
+ /// Generate a deterministic list of public keys of the given length.
218
220
pub fn gen_secp_pubkeys ( n : usize ) -> Vec < secp256k1:: PublicKey > {
219
221
let mut ret = Vec :: with_capacity ( n) ;
220
222
let secp = secp256k1:: Secp256k1 :: new ( ) ;
@@ -233,13 +235,15 @@ pub mod test {
233
235
ret
234
236
}
235
237
238
+ /// Generate a deterministic list of Bitcoin public keys of the given length.
236
239
pub fn gen_bitcoin_pubkeys ( n : usize , compressed : bool ) -> Vec < bitcoin:: PublicKey > {
237
240
gen_secp_pubkeys ( n)
238
241
. into_iter ( )
239
242
. map ( |inner| bitcoin:: PublicKey { inner, compressed } )
240
243
. collect ( )
241
244
}
242
245
246
+ /// Generate a deterministic list of test cases of the given length.
243
247
pub fn gen_testcases ( ) -> Vec < TestData > {
244
248
let k = gen_bitcoin_pubkeys ( 10 , true ) ;
245
249
let _h: Vec < hash160:: Hash > = k
0 commit comments