Add unit tests for Instructions, Fees, and Clock sysvars#357
Open
anand9125 wants to merge 3 commits intoanza-xyz:mainfrom
Open
Add unit tests for Instructions, Fees, and Clock sysvars#357anand9125 wants to merge 3 commits intoanza-xyz:mainfrom
anand9125 wants to merge 3 commits intoanza-xyz:mainfrom
Conversation
Author
|
Hey @febo pls review this pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds unit tests for three sysvars that previously had no tests:
sdk/src/sysvars/instructions.rs) – parsing and introspecting the Instructions sysvarsdk/src/sysvars/fees.rs) – FeeCalculator, FeeRateGovernor, and Fees construction and logicsdk/src/sysvars/clock.rs) –from_bytes/from_bytes_uncheckedand layout constantsInstructions sysvar
num_instructions(),load_current_index(),load_instruction_at(),get_instruction_relative()(in bounds, out of bounds, negative index).IntrospectedInstruction:num_account_metas(),get_program_id(),get_instruction_data(),get_instruction_account_at(), and account flags (is_signer,is_writable).Fees sysvar
FeeCalculator::new,FeeRateGovernor::default(),create_fee_calculator(),burn()(50%, 0%, 100%), andFees::new().Clock sysvar
Clockto bytes (repr(C) layout).Clock::LEN,from_bytes()(valid, too short, empty),from_bytes_unchecked(), and default constants.Testing
cargo test -p pinocchio