1
1
mod mock;
2
+
2
3
use crate :: mock:: * ;
3
4
use pallet_subtensor:: * ;
4
5
use sp_core:: Get ;
5
6
6
7
// 1. Test Zero Issuance
7
8
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_zero_issuance -- --exact --nocapture
8
9
#[ test]
10
+ #[ allow( clippy:: unwrap_used) ]
9
11
fn test_zero_issuance ( ) {
10
12
new_test_ext ( 1 ) . execute_with ( || {
11
13
let result = SubtensorModule :: get_block_emission_for_issuance ( 0 ) ;
@@ -18,6 +20,7 @@ fn test_zero_issuance() {
18
20
// 2. Test Maximum Issuance (Equal to Total Supply)
19
21
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_maximum_issuance -- --exact --nocapture
20
22
#[ test]
23
+ #[ allow( clippy:: unwrap_used) ]
21
24
fn test_maximum_issuance ( ) {
22
25
new_test_ext ( 1 ) . execute_with ( || {
23
26
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -31,6 +34,7 @@ fn test_maximum_issuance() {
31
34
// 3. Test Issuance Just Below Total Supply
32
35
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_issuance_just_below_total_supply -- --exact --nocapture
33
36
#[ test]
37
+ #[ allow( clippy:: unwrap_used) ]
34
38
fn test_issuance_just_below_total_supply ( ) {
35
39
new_test_ext ( 1 ) . execute_with ( || {
36
40
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -45,6 +49,7 @@ fn test_issuance_just_below_total_supply() {
45
49
// 4. Test Minimum Non-Zero Issuance
46
50
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_minimum_non_zero_issuance -- --exact --nocapture
47
51
#[ test]
52
+ #[ allow( clippy:: unwrap_used) ]
48
53
fn test_minimum_non_zero_issuance ( ) {
49
54
new_test_ext ( 1 ) . execute_with ( || {
50
55
let result = SubtensorModule :: get_block_emission_for_issuance ( 1 ) ;
@@ -58,6 +63,7 @@ fn test_minimum_non_zero_issuance() {
58
63
// 5. Test Default Block Emission
59
64
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_default_block_emission -- --exact --nocapture
60
65
#[ test]
66
+ #[ allow( clippy:: unwrap_used) ]
61
67
fn test_default_block_emission ( ) {
62
68
new_test_ext ( 1 ) . execute_with ( || {
63
69
let result = SubtensorModule :: get_block_emission ( ) ;
@@ -93,6 +99,7 @@ fn test_logarithm_calculation_boundary() {
93
99
// 7. Test Rounding Behavior
94
100
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_rounding_behavior -- --exact --nocapture
95
101
#[ test]
102
+ #[ allow( clippy:: unwrap_used) ]
96
103
fn test_rounding_behavior ( ) {
97
104
new_test_ext ( 1 ) . execute_with ( || {
98
105
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -112,6 +119,7 @@ fn test_rounding_behavior() {
112
119
// 8. Test Precision Loss
113
120
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_precision_loss -- --exact --nocapture
114
121
#[ test]
122
+ #[ allow( clippy:: unwrap_used) ]
115
123
fn test_precision_loss ( ) {
116
124
new_test_ext ( 1 ) . execute_with ( || {
117
125
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -133,6 +141,7 @@ fn test_precision_loss() {
133
141
// 9. Test Overflow Handling in Intermediate Calculations
134
142
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_overflow_handling -- --exact --nocapture
135
143
#[ test]
144
+ #[ allow( clippy:: unwrap_used) ]
136
145
fn test_overflow_handling ( ) {
137
146
new_test_ext ( 1 ) . execute_with ( || {
138
147
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -151,6 +160,7 @@ fn test_overflow_handling() {
151
160
// 10. Test Underflow Handling in Intermediate Calculations
152
161
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_underflow_handling -- --exact --nocapture
153
162
#[ test]
163
+ #[ allow( clippy:: unwrap_used) ]
154
164
fn test_underflow_handling ( ) {
155
165
new_test_ext ( 1 ) . execute_with ( || {
156
166
// Test with very small issuance values
@@ -167,6 +177,7 @@ fn test_underflow_handling() {
167
177
// 11. Test Division by Zero Prevention
168
178
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_division_by_zero_prevention -- --exact --nocapture
169
179
#[ test]
180
+ #[ allow( clippy:: unwrap_used) ]
170
181
fn test_division_by_zero_prevention ( ) {
171
182
new_test_ext ( 1 ) . execute_with ( || {
172
183
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -186,6 +197,7 @@ fn test_division_by_zero_prevention() {
186
197
// 12. Test Emission Rate Decrease with Increasing Issuance
187
198
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_emission_rate_decrease -- --exact --nocapture
188
199
#[ test]
200
+ #[ allow( clippy:: unwrap_used) ]
189
201
fn test_emission_rate_decrease ( ) {
190
202
new_test_ext ( 1 ) . execute_with ( || {
191
203
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -205,6 +217,7 @@ fn test_emission_rate_decrease() {
205
217
// 14. Test Block Emission Storage Update
206
218
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_block_emission_storage_update -- --exact --nocapture
207
219
#[ test]
220
+ #[ allow( clippy:: unwrap_used) ]
208
221
fn test_block_emission_storage_update ( ) {
209
222
new_test_ext ( 1 ) . execute_with ( || {
210
223
let initial_emission = BlockEmission :: < Test > :: get ( ) ;
@@ -232,6 +245,7 @@ fn test_block_emission_storage_update() {
232
245
// 15. Test Consistency Between get_block_emission() and get_block_emission_for_issuance()
233
246
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_emission_consistency -- --exact --nocapture
234
247
#[ test]
248
+ #[ allow( clippy:: unwrap_used) ]
235
249
fn test_emission_consistency ( ) {
236
250
new_test_ext ( 1 ) . execute_with ( || {
237
251
let emission_from_get = SubtensorModule :: get_block_emission ( ) . unwrap ( ) ;
@@ -249,6 +263,7 @@ fn test_emission_consistency() {
249
263
// 16. Test Performance with Large Issuance Values
250
264
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_performance_large_issuance -- --exact --nocapture
251
265
#[ test]
266
+ #[ allow( clippy:: unwrap_used) ]
252
267
fn test_performance_large_issuance ( ) {
253
268
new_test_ext ( 1 ) . execute_with ( || {
254
269
let large_issuance = TotalSupply :: < Test > :: get ( ) - 1_000_000_000 ;
@@ -271,6 +286,7 @@ fn test_performance_large_issuance() {
271
286
// 17. Test Performance with Small Issuance Values
272
287
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_performance_small_issuance -- --exact --nocapture
273
288
#[ test]
289
+ #[ allow( clippy:: unwrap_used) ]
274
290
fn test_performance_small_issuance ( ) {
275
291
new_test_ext ( 1 ) . execute_with ( || {
276
292
let small_issuance = 1000 ; // A small issuance value
@@ -294,6 +310,7 @@ fn test_performance_small_issuance() {
294
310
// 18. Test Emission at Key Issuance Milestones (e.g., 25%, 50%, 75% of Total Supply)
295
311
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_emission_at_key_milestones -- --exact --nocapture
296
312
#[ test]
313
+ #[ allow( clippy:: unwrap_used) ]
297
314
fn test_emission_at_key_milestones ( ) {
298
315
new_test_ext ( 1 ) . execute_with ( || {
299
316
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -321,6 +338,7 @@ fn test_emission_at_key_milestones() {
321
338
// 19. Test Behavior Near Total Supply Limit
322
339
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_behavior_near_total_supply -- --exact --nocapture
323
340
#[ test]
341
+ #[ allow( clippy:: unwrap_used) ]
324
342
fn test_behavior_near_total_supply ( ) {
325
343
new_test_ext ( 1 ) . execute_with ( || {
326
344
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -351,6 +369,7 @@ fn test_behavior_near_total_supply() {
351
369
// 20. Test with Maximum u64 Value as Issuance
352
370
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_maximum_u64_issuance -- --exact --nocapture
353
371
#[ test]
372
+ #[ allow( clippy:: unwrap_used) ]
354
373
fn test_maximum_u64_issuance ( ) {
355
374
new_test_ext ( 1 ) . execute_with ( || {
356
375
let max_issuance = u64:: MAX ;
@@ -365,6 +384,7 @@ fn test_maximum_u64_issuance() {
365
384
// 21. Test with Issuance Values That Cause Extreme Residuals
366
385
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_extreme_residuals -- --exact --nocapture
367
386
#[ test]
387
+ #[ allow( clippy:: unwrap_used) ]
368
388
fn test_extreme_residuals ( ) {
369
389
new_test_ext ( 1 ) . execute_with ( || {
370
390
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -388,6 +408,7 @@ fn test_extreme_residuals() {
388
408
// 22. Test Stability of Output Across Multiple Calls
389
409
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_output_stability -- --exact --nocapture
390
410
#[ test]
411
+ #[ allow( clippy:: unwrap_used) ]
391
412
fn test_output_stability ( ) {
392
413
new_test_ext ( 1 ) . execute_with ( || {
393
414
let test_issuance = 1_000_000_000 ; // 1 billion
@@ -408,6 +429,7 @@ fn test_output_stability() {
408
429
// 25. Test with Issuance Values That Produce Very Small Emissions
409
430
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_very_small_emissions -- --exact --nocapture
410
431
#[ test]
432
+ #[ allow( clippy:: unwrap_used) ]
411
433
fn test_very_small_emissions ( ) {
412
434
new_test_ext ( 1 ) . execute_with ( || {
413
435
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -429,6 +451,7 @@ fn test_very_small_emissions() {
429
451
// 26. Test Emission Calculation Time Complexity
430
452
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_emission_calculation_time_complexity -- --exact --nocapture
431
453
#[ test]
454
+ #[ allow( clippy:: unwrap_used) ]
432
455
fn test_emission_calculation_time_complexity ( ) {
433
456
new_test_ext ( 1 ) . execute_with ( || {
434
457
use std:: time:: Instant ;
@@ -460,6 +483,7 @@ fn test_emission_calculation_time_complexity() {
460
483
// 27. Test Emission Values Across Full Range of Possible Issuances
461
484
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_emission_values_across_issuance_range -- --exact --nocapture
462
485
#[ test]
486
+ #[ allow( clippy:: unwrap_used) ]
463
487
fn test_emission_values_across_issuance_range ( ) {
464
488
new_test_ext ( 1 ) . execute_with ( || {
465
489
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -487,6 +511,7 @@ fn test_emission_values_across_issuance_range() {
487
511
// 28. Test Consistency of Emission Decrease Rate
488
512
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_consistency_of_emission_decrease_rate -- --exact --nocapture
489
513
#[ test]
514
+ #[ allow( clippy:: unwrap_used) ]
490
515
fn test_consistency_of_emission_decrease_rate ( ) {
491
516
new_test_ext ( 1 ) . execute_with ( || {
492
517
let total_supply = TotalSupply :: < Test > :: get ( ) ;
@@ -524,6 +549,7 @@ fn test_consistency_of_emission_decrease_rate() {
524
549
// 30. Test Impact of Floating Point Precision on Final Emission Value
525
550
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --test block_emission test_floating_point_precision_impact -- --exact --nocapture
526
551
#[ test]
552
+ #[ allow( clippy:: unwrap_used) ]
527
553
fn test_floating_point_precision_impact ( ) {
528
554
new_test_ext ( 1 ) . execute_with ( || {
529
555
let total_supply = TotalSupply :: < Test > :: get ( ) ;
0 commit comments