BigInt fixes corresponding to algebra#372

Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
This commit is contained in:
Marcin
2022-01-10 20:03:40 +01:00
committed by GitHub
parent d1ced15cc2
commit 6a5cf1d84a
32 changed files with 315 additions and 307 deletions

View File

@@ -1,5 +1,5 @@
use ark_ff::{
biginteger::{BigInteger, BigInteger384},
biginteger::{BigInt, BigInteger, BigInteger384},
fields::{
fp6_3over2::Fp6Parameters, FftField, FftParameters, Field, Fp2Parameters, FpParameters,
PrimeField, SquareRootField,
@@ -24,10 +24,7 @@ generate_field_serialization_test!(bls12_377; fq2; fq6; fq12;);
#[test]
fn test_fq_repr_from() {
assert_eq!(
BigInteger384::from(100),
BigInteger384([100, 0, 0, 0, 0, 0])
);
assert_eq!(BigInt::from(100u64), BigInt::new([100, 0, 0, 0, 0, 0]));
}
#[test]
@@ -44,9 +41,9 @@ fn test_fq_repr_is_odd() {
#[test]
fn test_fq_repr_is_zero() {
assert!(BigInteger384::from(0).is_zero());
assert!(!BigInteger384::from(1).is_zero());
assert!(!BigInteger384([0, 0, 0, 0, 1, 0]).is_zero());
assert!(BigInteger384::from(0u64).is_zero());
assert!(!BigInteger384::from(1u64).is_zero());
assert!(!BigInt::new([0, 0, 0, 0, 1, 0]).is_zero());
}
#[test]