(t *testing.T)
| 88 | } |
| 89 | |
| 90 | func TestCalculateBlocksDiff_AggressiveBackoff(t *testing.T) { |
| 91 | // EpochBlocksBackoffPercent=100 (100%), base = 2.0 |
| 92 | // result = 10 * 2^steps, truncated |
| 93 | params := defaultTestParams() |
| 94 | params.EpochBlocksBackoffPercent = 100 |
| 95 | |
| 96 | tests := []struct { |
| 97 | name string |
| 98 | cr int64 |
| 99 | expected int64 |
| 100 | }{ |
| 101 | {"cr_9500_steps_0", 9500, 10}, |
| 102 | // steps=1 → 10 * 2 = 20 |
| 103 | {"cr_9490_steps_1", 9490, 20}, |
| 104 | // steps=2 → 10 * 4 = 40 |
| 105 | {"cr_9480_steps_2", 9480, 40}, |
| 106 | // steps=5 → 10 * 32 = 320 |
| 107 | {"cr_9450_steps_5", 9450, 320}, |
| 108 | // steps=10 → 10 * 1024 = 10240 |
| 109 | {"cr_9400_steps_10", 9400, 10240}, |
| 110 | // steps=11 → 10 * 2048 = 20480 → capped at 14400 |
| 111 | {"cr_9390_steps_11_capped", 9390, 14400}, |
| 112 | // steps=50 → massive number → capped at 14400 |
| 113 | {"cr_9000_steps_50_capped", 9000, 14400}, |
| 114 | } |
| 115 | |
| 116 | for _, tc := range tests { |
| 117 | t.Run(tc.name, func(t *testing.T) { |
| 118 | result := calculateBlocksDiff(params, tc.cr) |
| 119 | require.Equal(t, tc.expected, result, "cr=%d", tc.cr) |
| 120 | }) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | func TestCalculateBlocksDiff_Cap14400(t *testing.T) { |
| 125 | params := defaultTestParams() |
nothing calls this directly
no test coverage detected