-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c00ff9
commit 47bb22d
Showing
5 changed files
with
85 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ mod bn254; | |
mod extension_field; | ||
mod field; | ||
mod gf2; | ||
mod gf2_127; | ||
mod gf2_128; | ||
mod gf2_128x8; | ||
mod m31; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use ark_std::test_rng; | ||
use std::io::Cursor; | ||
|
||
use crate::{FieldSerde, GF2_127}; | ||
|
||
use super::{ | ||
extension_field::random_extension_field_tests, | ||
field::{random_field_tests, random_inversion_tests}, | ||
simd_field::random_simd_field_tests, | ||
}; | ||
|
||
#[test] | ||
fn test_field() { | ||
random_field_tests::<GF2_127>("GF2_127".to_string()); | ||
random_extension_field_tests::<GF2_127>("GF2_127".to_string()); | ||
|
||
let mut rng = test_rng(); | ||
random_inversion_tests::<GF2_127, _>(&mut rng, "GF2_127".to_string()); | ||
} | ||
|
||
#[test] | ||
fn test_custom_serde_vectorize_gf2() { | ||
let a = GF2_127::from(0); | ||
let mut buffer = vec![]; | ||
assert!(a.serialize_into(&mut buffer).is_ok()); | ||
let mut cursor = Cursor::new(buffer); | ||
let b = GF2_127::deserialize_from(&mut cursor); | ||
assert!(b.is_ok()); | ||
let b = b.unwrap(); | ||
assert_eq!(a, b); | ||
} |