Skip to content

test: cover nextSubtreeSize - #335

Merged
rach-id merged 2 commits into
celestiaorg:mainfrom
loglapa:test-next-subtree-size-265
Aug 21, 2026
Merged

test: cover nextSubtreeSize#335
rach-id merged 2 commits into
celestiaorg:mainfrom
loglapa:test-next-subtree-size-265

Conversation

@loglapa

@loglapa loglapa commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Closes #265

Summary

  • add direct table-driven coverage for nextSubtreeSize
  • cover ranges limited by start alignment and by remaining length
  • cover zero, unaligned, and larger aligned starts

Testing

  • go test ./...
  • go vet ./...
  • golangci-lint run --timeout 10m
  • git diff --check

Signed-off-by: Vladislav Lapin <v.lapin@scalablesolutions.io>
@loglapa
loglapa marked this pull request as ready for review August 20, 2026 10:41
@loglapa
loglapa requested a review from a team as a code owner August 20, 2026 10:41
@loglapa
loglapa requested review from pippokr and removed request for a team August 20, 2026 10:41

@rach-id rach-id left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this prompt to include the relevant test cases:

Update PR #335 to strengthen TestNextSubtreeSize in proof_test.go.

The current table only uses power-of-two range lengths, and every positive even start is itself a power of two. Add table cases that exercise:

  • Rounding a non-power-of-two remaining span down, such as (start: 0, end: 12) → 8 and (start: 8, end: 14) → 4.
  • Alignment for a composite even start, such as (start: 12, end: 20) → 4.

Keep the change test-only unless investigation reveals an actual implementation defect. Use descriptive case names consistent with the existing table.

After editing, run:

go test ./...
go vet ./...
git diff --check

Review the final diff to ensure the new cases independently constrain both behaviors implemented by nextSubtreeSize: start alignment and rounding based on the remaining range.

@loglapa

loglapa commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the requested coverage in a0841be: added independent cases for non-power-of-two remaining spans at (0, 12) and (8, 14), plus composite-even start alignment at (12, 20). Validation passed: go test ./..., go vet ./..., and git diff --check.

@rach-id
rach-id merged commit e2177ee into celestiaorg:main Aug 21, 2026
7 checks passed
@loglapa
loglapa deleted the test-next-subtree-size-265 branch August 24, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add unit tests for nextSubtreeSize

2 participants