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:
parent
47e4bff0ee
commit
3298c0c4b5
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue