Skip to content

Commit

Permalink
Fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Jan 25, 2024
1 parent cd279f1 commit 2931518
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_explode_gaps.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
from background_tasks import explode_gap


def check_gaps(start_slot, end_slot, sprp):
result = explode_gap(start_slot, end_slot, sprp=sprp)

assert len(result) > 0

prev_start = None
prev_end = None
for (start, end) in result:
for start, end in result:
assert start < end
assert start == start_slot or (start == prev_end + 1 and start % sprp == 1)
assert end == end_slot or (end < end_slot and end % sprp == 0)
prev_start = start
prev_end = end


def test_explode_large_gap():
start_slot = 14273
end_slot = 7530327
sprp = 2048
check_gaps(start_slot, end_slot, sprp)


def test_explode_small_gap_unaligned():
start_slot = 1
end_slot = 10
sprp = 2048
check_gaps(start_slot, end_slot, sprp)


def test_explode_small_gap_aligned():
start_slot = 1
end_slot = 2048
Expand Down

0 comments on commit 2931518

Please sign in to comment.