@@ -26,13 +26,16 @@ impl CardanoTransactionsBuilder {
26
26
}
27
27
28
28
/// Define how many transactions we generate in each block.
29
- pub fn per_block ( mut self , transactions_per_block : usize ) -> Self {
29
+ pub fn max_transactions_per_block ( mut self , transactions_per_block : usize ) -> Self {
30
30
self . max_transactions_per_block = transactions_per_block;
31
31
self
32
32
}
33
33
34
34
/// Define how many transactions we generate for one immutable_file.
35
- pub fn per_immutable_file ( mut self , transactions_per_immutable_file : usize ) -> Self {
35
+ pub fn max_transactions_per_immutable_file (
36
+ mut self ,
37
+ transactions_per_immutable_file : usize ,
38
+ ) -> Self {
36
39
self . max_transactions_per_immutable_file = transactions_per_immutable_file;
37
40
self
38
41
}
@@ -56,11 +59,6 @@ impl CardanoTransactionsBuilder {
56
59
self
57
60
}
58
61
59
- /// Default build that build only one transaction.
60
- pub fn build ( self ) -> Vec < CardanoTransaction > {
61
- self . build_transactions ( 1 )
62
- }
63
-
64
62
/// Build the number of transactions requested.
65
63
pub fn build_transactions ( self , transactions_count : usize ) -> Vec < CardanoTransaction > {
66
64
let mut transactions = Vec :: new ( ) ;
@@ -147,13 +145,6 @@ mod test {
147
145
list. iter ( ) . map ( extract_value) . collect ( )
148
146
}
149
147
150
- #[ test]
151
- fn return_one_transaction_by_default ( ) {
152
- let transactions = CardanoTransactionsBuilder :: new ( ) . build ( ) ;
153
-
154
- assert_eq ! ( transactions. len( ) , 1 ) ;
155
- }
156
-
157
148
#[ test]
158
149
fn return_given_number_of_transactions_with_distinct_values ( ) {
159
150
let txs = CardanoTransactionsBuilder :: new ( ) . build_transactions ( 3 ) ;
@@ -174,7 +165,7 @@ mod test {
174
165
fn return_all_transactions_in_same_block_when_ask_less_transactions_than_transactions_per_block (
175
166
) {
176
167
let txs = CardanoTransactionsBuilder :: new ( )
177
- . per_block ( 10 )
168
+ . max_transactions_per_block ( 10 )
178
169
. build_transactions ( 3 ) ;
179
170
180
171
assert_eq ! ( txs. len( ) , 3 ) ;
@@ -190,7 +181,7 @@ mod test {
190
181
#[ test]
191
182
fn return_no_more_transactions_in_a_same_block_than_number_per_block_requested ( ) {
192
183
let txs = CardanoTransactionsBuilder :: new ( )
193
- . per_block ( 3 )
184
+ . max_transactions_per_block ( 3 )
194
185
. build_transactions ( 12 ) ;
195
186
196
187
assert_eq ! ( txs. len( ) , 12 ) ;
@@ -206,7 +197,7 @@ mod test {
206
197
#[ test]
207
198
fn only_the_last_block_is_not_full_when_we_can_not_fill_all_blocks ( ) {
208
199
let txs = CardanoTransactionsBuilder :: new ( )
209
- . per_block ( 5 )
200
+ . max_transactions_per_block ( 5 )
210
201
. build_transactions ( 12 ) ;
211
202
212
203
assert_eq ! ( txs. len( ) , 12 ) ;
@@ -245,7 +236,7 @@ mod test {
245
236
#[ test]
246
237
fn build_block_ranges_return_many_transactions_per_block_when_requested ( ) {
247
238
let txs = CardanoTransactionsBuilder :: new ( )
248
- . per_block ( 5 )
239
+ . max_transactions_per_block ( 5 )
249
240
. build_block_ranges ( 3 ) ;
250
241
251
242
assert_eq ! ( txs. len( ) , 3 * 5 ) ;
@@ -266,7 +257,7 @@ mod test {
266
257
#[ test]
267
258
fn build_block_ranges_with_many_blocks_per_block_ranges ( ) {
268
259
let txs = CardanoTransactionsBuilder :: new ( )
269
- . per_block ( 5 )
260
+ . max_transactions_per_block ( 5 )
270
261
. blocks_per_block_range ( 2 )
271
262
. build_block_ranges ( 3 ) ;
272
263
@@ -291,7 +282,7 @@ mod test {
291
282
#[ test]
292
283
fn build_transactions_with_many_blocks_per_block_ranges ( ) {
293
284
let txs = CardanoTransactionsBuilder :: new ( )
294
- . per_block ( 5 )
285
+ . max_transactions_per_block ( 5 )
295
286
. blocks_per_block_range ( 2 )
296
287
. build_transactions ( 18 ) ;
297
288
@@ -324,7 +315,7 @@ mod test {
324
315
#[ test]
325
316
fn build_transactions_with_many_transactions_per_immutable_file ( ) {
326
317
let transactions = CardanoTransactionsBuilder :: new ( )
327
- . per_immutable_file ( 5 )
318
+ . max_transactions_per_immutable_file ( 5 )
328
319
. build_transactions ( 18 ) ;
329
320
330
321
assert_eq ! ( transactions. len( ) , 18 ) ;
@@ -338,7 +329,7 @@ mod test {
338
329
#[ test]
339
330
fn build_transactions_with_same_number_of_transactions_per_immutable_file ( ) {
340
331
let transactions = CardanoTransactionsBuilder :: new ( )
341
- . per_immutable_file ( 5 )
332
+ . max_transactions_per_immutable_file ( 5 )
342
333
. build_transactions ( 20 ) ;
343
334
344
335
assert_eq ! ( transactions. len( ) , 20 ) ;
0 commit comments