p3_baby_bear/
extension.rs

1#[cfg(test)]
2mod test_quartic_extension {
3    use alloc::format;
4
5    use p3_field::extension::BinomialExtensionField;
6    use p3_field::{FieldAlgebra, FieldExtensionAlgebra};
7    use p3_field_testing::{test_field, test_two_adic_extension_field};
8
9    use crate::BabyBear;
10
11    type F = BabyBear;
12    type EF = BinomialExtensionField<F, 4>;
13
14    test_field!(super::EF);
15    test_two_adic_extension_field!(super::F, super::EF);
16
17    #[test]
18    fn display() {
19        assert_eq!(format!("{}", EF::ZERO), "0");
20        assert_eq!(format!("{}", EF::ONE), "1");
21        assert_eq!(format!("{}", EF::TWO), "2");
22
23        assert_eq!(
24            format!(
25                "{}",
26                EF::from_base_slice(&[F::TWO, F::ONE, F::ZERO, F::TWO])
27            ),
28            "2 + X + 2 X^3"
29        );
30    }
31}
32
33#[cfg(test)]
34mod test_quintic_extension {
35    use p3_field::extension::BinomialExtensionField;
36    use p3_field_testing::{test_field, test_two_adic_extension_field};
37
38    use crate::BabyBear;
39
40    type F = BabyBear;
41    type EF = BinomialExtensionField<F, 5>;
42
43    test_field!(super::EF);
44    test_two_adic_extension_field!(super::F, super::EF);
45}