Add unit tests for bytecode argument reading (args.rs)#5287
Open
Cypher-CP0 wants to merge 1 commit intoboa-dev:mainfrom
Open
Add unit tests for bytecode argument reading (args.rs)#5287Cypher-CP0 wants to merge 1 commit intoboa-dev:mainfrom
args.rs)#5287Cypher-CP0 wants to merge 1 commit intoboa-dev:mainfrom
Conversation
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
Closes #4240
Adds unit tests for the bytecode argument reading logic in
core/engine/src/vm/opcode/args.rs, as requested in the linked issue.Changes
Added the following test coverage inside the existing
#[cfg(test)] mod testsblock inargs.rs:Direct
readfunction testsread_u8_direct— basic u8 readread_u16_little_endian— verifies correct little-endian byte ordering for u16read_u32_little_endian— verifies correct little-endian byte ordering for u32read_at_non_zero_offset— verifies reading from a non-zero offset advancesposcorrectlySigned negative value tests
read_i8_negative— reads -1 as i8read_i16_negative— reads -1 as i16 in little-endianread_i32_negative— readsi32::MINfrom raw bytesOperand edge cases
register_operand_large_value—RegisterOperandwithu32::MAXindex_operand_mid_value—IndexOperandwith a mid-range valueaddress_max_value—Addresswithu32::MAXdecode_at_non_zero_offset— decodes the second of two back-to-back encoded valuesPrimitive edge cases
test_i8_max,test_i16_min_max,test_i32_max,test_u8_mid_valueFloat special values
test_f32_special_values— NaN, +inf, -inf for f32test_f64_special_values— NaN, +inf, -inf for f64Additional tuple combinations
test_triple_tuple_round_trip— 3-element tuplestest_five_tuple_round_trip— 5-element tuplesAdditional panic/truncation tests
decode_u16_truncated_panics— 1 byte buffer for u16decode_u64_truncated_panics— 4 byte buffer for u64decode_at_offset_past_end_panics— offset + size exceeds buffer lengthAdditional ThinVec tests
test_thin_vec_single_element— single element vectest_thin_vec_index_operand— ThinVec of IndexOperand with min/max values