-
Notifications
You must be signed in to change notification settings - Fork 694
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
Implement FromStr
for UDecimal
/Decimal
.
#142
Implement FromStr
for UDecimal
/Decimal
.
#142
Conversation
Can you add a fuzz test that tries to parse a decimal, and when it succeeds tries to reserialize it (and check that it roundtrips correctly)? |
8c892c4
to
175895b
Compare
Done |
Nice, thanks! Unfortunately it looks like it failed trying to roundtrip the number '6' (which I kinda expected to happen ... that should obviously parse as a 6, but then I'd expect it to serialize as 6.00000000, so I guess the fuzz test needs to be more accepting... perhaps it should parse, then serialize, then parse again, and check that both parses gave the same Also, not a big deal, but in future I'd appreciate if fuzz-tests would appear in their own commit, because they're generally independent of other changes and can be reviewed independently. |
Signed-off-by: Jean Pierre Dudey <[email protected]>
Signed-off-by: Jean Pierre Dudey <[email protected]>
175895b
to
be0d547
Compare
Done 👍, fuzz tests are now in their own commit. |
Build is failing because |
Tracking issue: rust-lang/cc-rs#336 |
Looks like there is also a failing fuzz test case (hex |
…mal`. Signed-off-by: Jean Pierre Dudey <[email protected]>
Signed-off-by: Jean Pierre Dudey <[email protected]>
That hex string is the number |
Ok, don't know why tests are failing I'm feeling stupid right now :P, I'm going to sleep and check that tomorrow. |
Signed-off-by: Jean Pierre Dudey <[email protected]>
8fe36fd
to
a915bc1
Compare
The negative symbol wasn't there when `int_part` was equal to zero. Signed-off-by: Jean Pierre Dudey <[email protected]>
I don't mind the churn, but you may find life easier if you run I'm glad we're finding this stuff though ... I expect all of these issues existed in the old code, we just never sussed them out. |
@apoelstra I can't do fuzzing right now on my PC (some reasons, not related to this), that's why I'm pushing and fixing. |
Also the tests are failing with the bytes let ten = 10i64.pow(self.exponent as u32); Not sure how to handle this though. |
I think we should just forbid exponents larger than 18. I guess this could cause issues for Dogecoin or something but we don't support anything like that now. |
Signed-off-by: Jean Pierre Dudey <[email protected]>
lol, the build is finally green |
Thanks so much! Seems like most of the bugs were latent and had been hanging around since 2014 so it's awesome to finally clear them out. |
Solves #140