use cryptix_bigint::{BigUInt, property::IsBigInt, bigint}; type U256 = BigUInt; #[test] fn test_property() { let a = bigint!(U256, "00"); assert_eq!(a.bit_nlz(), U256::BIT_LEN); assert_eq!(a.bit_len(), 0); assert_eq!(a.seg_len(), 0); let (b, _) = a - 1; assert_eq!(b.bit_nlz(), 0); assert_eq!(b.seg_len(), U256::DIG_LEN); assert_eq!(b.bit_len(), U256::BIT_LEN); let r = bigint!(U256, "deadbeefdeadbeef"); assert_eq!(r.bit_len(), 64); assert_eq!(r.seg_len(), 1); let (r2, _) = r * 2; assert_eq!(r2.bit_len(), 65); assert_eq!(r2.seg_len(), 2); }