From 1833289cf61399af4e3ef94a3d657be9135ceab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Lindstr=C3=B8m?= Date: Thu, 5 Dec 2024 14:14:38 +0100 Subject: [PATCH] Reorder test --- fastcrypto/src/tests/bls12381_group_tests.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fastcrypto/src/tests/bls12381_group_tests.rs b/fastcrypto/src/tests/bls12381_group_tests.rs index c9f363dca..95ad5873a 100644 --- a/fastcrypto/src/tests/bls12381_group_tests.rs +++ b/fastcrypto/src/tests/bls12381_group_tests.rs @@ -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 @@ -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]