mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-05 23:33:07 +00:00
fixed tests
This commit is contained in:
parent
b17dabefeb
commit
292a28e6e3
@ -132,8 +132,9 @@ impl Field for QuarticCrandallField {
|
|||||||
let combined_first = second as u128 * (1u128 << 64) + first as u128;
|
let combined_first = second as u128 * (1u128 << 64) + first as u128;
|
||||||
let combined_second = fourth as u128 * (1u128 << 64) + third as u128;
|
let combined_second = fourth as u128 * (1u128 << 64) + third as u128;
|
||||||
|
|
||||||
let combined = BigUint::from(combined_second) * (BigUint::from(1u32) << 128) + combined_first;
|
let combined =
|
||||||
|
BigUint::from(combined_second) * (BigUint::from(1u32) << 128) + combined_first;
|
||||||
|
|
||||||
combined
|
combined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -132,7 +132,8 @@ pub fn run_binaryop_test_cases<F, BinaryOp, ExpectedOp>(
|
|||||||
.zip(shifted_inputs.clone())
|
.zip(shifted_inputs.clone())
|
||||||
.map(|(x, y)| (x.clone(), y.clone()))
|
.map(|(x, y)| (x.clone(), y.clone()))
|
||||||
.map(|(x, y)| {
|
.map(|(x, y)| {
|
||||||
op(F::from_canonical_biguint(x), F::from_canonical_biguint(y)).to_canonical_biguint()
|
op(F::from_canonical_biguint(x), F::from_canonical_biguint(y))
|
||||||
|
.to_canonical_biguint()
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
@ -165,10 +166,10 @@ macro_rules! test_arithmetic {
|
|||||||
fn arithmetic_addition() {
|
fn arithmetic_addition() {
|
||||||
let modulus = <$field>::order();
|
let modulus = <$field>::order();
|
||||||
crate::field::field_testing::run_binaryop_test_cases(
|
crate::field::field_testing::run_binaryop_test_cases(
|
||||||
modulus,
|
modulus.clone(),
|
||||||
WORD_BITS,
|
WORD_BITS,
|
||||||
<$field>::add,
|
<$field>::add,
|
||||||
BigUint::add,
|
|x, y| (x.clone() + y.clone()) % modulus.clone(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,10 +211,10 @@ macro_rules! test_arithmetic {
|
|||||||
fn arithmetic_multiplication() {
|
fn arithmetic_multiplication() {
|
||||||
let modulus = <$field>::order();
|
let modulus = <$field>::order();
|
||||||
crate::field::field_testing::run_binaryop_test_cases(
|
crate::field::field_testing::run_binaryop_test_cases(
|
||||||
modulus,
|
modulus.clone(),
|
||||||
WORD_BITS,
|
WORD_BITS,
|
||||||
<$field>::mul,
|
<$field>::mul,
|
||||||
BigUint::mul,
|
|x, y| x.clone() * y.clone() % modulus.clone(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,10 +222,10 @@ macro_rules! test_arithmetic {
|
|||||||
fn arithmetic_square() {
|
fn arithmetic_square() {
|
||||||
let modulus = <$field>::order();
|
let modulus = <$field>::order();
|
||||||
crate::field::field_testing::run_unaryop_test_cases(
|
crate::field::field_testing::run_unaryop_test_cases(
|
||||||
modulus,
|
modulus.clone(),
|
||||||
WORD_BITS,
|
WORD_BITS,
|
||||||
|x: $field| x.square(),
|
|x: $field| x.square(),
|
||||||
|x| x.clone() * x,
|
|x| (x.clone() * x.clone()) % modulus.clone(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user