cairo-lang-utils 2.18.0

General utilities for the Cairo compiler project.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::bigint::BigIntAsHex;

#[test]
fn encode_bigint() {
    use core::str::FromStr;

    use parity_scale_codec::{Decode, Encode};

    let bigint = BigIntAsHex {
        value: num_bigint::BigInt::from_str(
            "3618502788666131106986593281521497120414687020801267626233049500247285301248",
        )
        .unwrap(),
    };
    let encoding = bigint.encode();
    let decoded = BigIntAsHex::decode(&mut encoding.as_slice()).unwrap();
    assert_eq!(bigint, decoded);
}