From 86af5f9b145f49e9327529d48577734dc27920a5 Mon Sep 17 00:00:00 2001 From: Federica Date: Tue, 2 Jan 2024 17:36:57 -0300 Subject: [PATCH] Add test --- .../src/curve/projective_point.rs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/crates/starknet-types-core/src/curve/projective_point.rs b/crates/starknet-types-core/src/curve/projective_point.rs index f5c1d39..a1fecc8 100644 --- a/crates/starknet-types-core/src/curve/projective_point.rs +++ b/crates/starknet-types-core/src/curve/projective_point.rs @@ -224,4 +224,36 @@ mod test { .unwrap() ) } + + #[test] + // Results checked against starknet-rs https://github.com/xJonathanLEI/starknet-rs/ + fn double_operations() { + let projective_point = ProjectivePoint::new( + Felt::from_dec_str( + "874739451078007766457464989774322083649278607533249481151382481072868806602", + ) + .unwrap(), + Felt::from_dec_str( + "152666792071518830868575557812948353041420400780739481342941381225525861407", + ) + .unwrap(), + Felt::from(1), + ); + + assert_eq!( + projective_point.double().to_affine().unwrap(), + AffinePoint::new( + Felt::from_dec_str( + "3324833730090626974525872402899302150520188025637965566623476530814354734325", + ) + .unwrap(), + Felt::from_dec_str( + "3147007486456030910661996439995670279305852583596209647900952752170983517249", + ) + .unwrap() + ) + .unwrap() + ); + } + }