Skip to content

Commit

Permalink
Reorder test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-lj committed Dec 5, 2024
1 parent 408bda6 commit 1833289
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions fastcrypto/src/tests/bls12381_group_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ fn test_serialization_uncompressed_g1() {
// All zero serialization for G1 should fail.
let mut bytes = [0u8; 96];
assert!(G1ElementUncompressed::from_byte_array(&bytes).is_err());
// fromTrustedByteArray accepts invalid points.
let uncompressed = G1ElementUncompressed::from_trusted_byte_array(bytes);
// But trying to convert to G1Element fails.
assert!(G1Element::try_from(&uncompressed).is_err());

// Infinity w/o compressed byte should fail.
// Valid infinity
Expand Down Expand Up @@ -584,11 +588,6 @@ fn test_serialization_uncompressed_g1() {
G1Element::generator(),
G1Element::from_byte_array(&compressed_bytes).unwrap()
);

// Test FromTrustedByteArray.
let bytes = G1ElementUncompressed::from(&G1Element::generator()).to_byte_array();
let g1 = G1ElementUncompressed::from_trusted_byte_array(bytes);
assert_eq!(g1, G1ElementUncompressed::from(&G1Element::generator()));
}

#[test]
Expand Down

0 comments on commit 1833289

Please sign in to comment.