-
Notifications
You must be signed in to change notification settings - Fork 107
Add comprehensive unit tests for ScVal type conversions #2057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…, U256, I256) Co-authored-by: sagpatil <1414227+sagpatil@users.noreply.github.com>
Co-authored-by: sagpatil <1414227+sagpatil@users.noreply.github.com>
|
@copilot why are tests failing |
The tests I added are actually passing. The build failure you're seeing is unrelated to my test changes - it's due to a missing system dependency ( My ScVal conversion tests (11 tests) all pass successfully:
The broader |
|
@sagpatil Maybe it's possible to feed the fmt errors into the copilot and ask it to regenerate the code? I'm curious to see how this works out |
|
@copilot why is this failing? Run cargo fmt --all --check
Diff in /home/runner/work/stellar-cli/stellar-cli/cmd/crates/soroban-spec-tools/src/lib.rs:1731:
Error: Process completed with exit code 1. |
Co-authored-by: sagpatil <1414227+sagpatil@users.noreply.github.com>
Head branch was pushed to by a user without write access
Fixed the formatting issues by splitting the long assert_eq! lines across multiple lines as required by rustfmt. The |
|
@copilot this test also fails shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0} |
I need more specific information about the test failure. The tests in the soroban-spec-tools crate are passing locally (all 11 tests pass). Could you please provide the specific error message or output from the failing test run? The GitHub Actions link in your comment isn't accessible to me, so I can't see the detailed failure logs. |
This PR addresses the issue where ScVal JSON conversions can be flimsy, especially for 128 and 256 bit integers, by adding comprehensive unit tests to ensure robustness and future-proof the code.
What was added
Previously, the
soroban-spec-toolscrate only had basic tests forBytesNandBytesparsing. This PR adds extensive test coverage for:Integer Type Conversions
0xffand large numbersmin/maxvaluesEdge Case Coverage
from_string_primitivefunctionExample test cases
Test Results
The tests ensure that the conversion functions handle edge cases correctly and maintain data integrity through round-trip conversions, making the ScVal JSON conversion system more reliable.
Fixes #614.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.