Skip to content

[QDP] Add unit tests for streaming amplitude encoder coverage#1200

Open
0lai0 wants to merge 2 commits intoapache:mainfrom
0lai0:test_amplitude
Open

[QDP] Add unit tests for streaming amplitude encoder coverage#1200
0lai0 wants to merge 2 commits intoapache:mainfrom
0lai0:test_amplitude

Conversation

@0lai0
Copy link
Contributor

@0lai0 0lai0 commented Mar 17, 2026

Related Issues

Closes #1180

Changes

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Test
  • CI/CD pipeline
  • Other

Why

encoding/amplitude.rs had less code coverage. This means there was no regression protection for sample size validation, state initialization, or the streaming encoding path.

How

Added 6 unit tests in qdp/qdp-core/src/encoding/amplitude.rs :

reject_sample_size_zero
— validates sample_size == 0 returns InvalidInput

reject_sample_size_exceeds_stage
— validates sample_size > STAGE_SIZE_ELEMENTS returns InvalidInput

accept_valid_sample_size
— confirms valid size passes

accept_max_valid_sample_size
— boundary test at STAGE_SIZE_ELEMENTS

needs_staging_copy_returns_true
— verifies default trait impl

init_state_allocates_norm_buffer
— confirms GPU norm buffer allocation succeeds

Checklist

  • Added or updated unit tests for all changes
  • Added or updated documentation for all changes
image

@0lai0 0lai0 changed the title Add unit tests for streaming amplitude encoder coverage [QDP] Add unit tests for streaming amplitude encoder coverage Mar 17, 2026
@guan404ming
Copy link
Member

Hi @0lai0, I think there is some issue in rebasing process on Github which causing the commit error. Could you please commit again with your account, thanks!

@0lai0
Copy link
Contributor Author

0lai0 commented Mar 18, 2026

Sure, should I close this PR?

@0lai0
Copy link
Contributor Author

0lai0 commented Mar 18, 2026

Thanks for catching that! I found this issue was my git config had an invalid email format (0lai0 instead of a proper email address), which caused the commit author info to appear broken after rebasing. I've fixed my git config and re-committed with --amend --reset-author. The force push should now show the correct author. Sorry for the trouble!

@0lai0
Copy link
Contributor Author

0lai0 commented Mar 18, 2026

If this still broken I would commit again

@guan404ming
Copy link
Member

It works now. THanks for the update.

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.

[Feature] Add tests for streaming amplitude encoder coverage

2 participants