pow: Unit test from_hex_internal

Add a unit test that fails if put before the "pow: Fix off-by-one error"
patch. Tests that we can correctly parse a 32 character long hex string
into a `U256`.
This commit is contained in:
Tobin C. Harding 2024-06-05 08:41:02 +10:00
parent 47e4bff0ee
commit 3298c0c4b5
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 8 additions and 0 deletions

View File

@ -1652,6 +1652,14 @@ mod tests {
assert_eq!(got, val);
}
#[test]
fn u256_from_hex_32_characters_long() {
let hex = "a69b455cd41bb662a69b4555deadbeef";
let want = U256(0x00, 0xA69B_455C_D41B_B662_A69B_4555_DEAD_BEEF);
let got = U256::from_unprefixed_hex(hex).expect("failed to parse hex");
assert_eq!(got, want);
}
#[cfg(feature = "serde")]
#[test]
fn u256_serde() {