From f625f614067d8bd4223361ac58b8c913645b6f52 Mon Sep 17 00:00:00 2001 From: delaaxe <1091900+delaaxe@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:40:00 +0000 Subject: [PATCH] Fix test --- src/math/src/tests/lcm_of_n_numbers_test.cairo | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/math/src/tests/lcm_of_n_numbers_test.cairo b/src/math/src/tests/lcm_of_n_numbers_test.cairo index 1f51879a..bdccc603 100644 --- a/src/math/src/tests/lcm_of_n_numbers_test.cairo +++ b/src/math/src/tests/lcm_of_n_numbers_test.cairo @@ -1,9 +1,9 @@ use alexandria_math::lcm_of_n_numbers::{lcm, LCMError}; -use core::traits::Into; // the following trait is not safe, it is only used for testing. -impl u128_to_u32 of Into { +impl u128_into_u32 of Into { fn into(self: u128) -> u32 { + let self: felt252 = self.into(); self.try_into().unwrap() } } @@ -11,35 +11,35 @@ impl u128_to_u32 of Into { #[test] #[available_gas(1000000000)] fn lcm_test() { - let arr = array![2_u128, 4_u128, 6_u128, 8_u128, 10_u128]; + let arr = array![2_u128, 4, 6, 8, 10]; assert(lcm(arr.span()).unwrap() == 120, 'invalid result'); } #[test] #[available_gas(1000000000)] fn lcm_test_tryinto() { - let arr = array![2_u32, 4_u32, 6_u32, 8_u32, 10_u32]; + let arr = array![2_u32, 4, 6, 8, 10]; assert(lcm(arr.span()).unwrap() == 120, 'invalid result'); } #[test] #[available_gas(1000000000)] fn lcm_test_inverse() { - let arr = array![10_u128, 8_u128, 6_u128, 4_u128, 2_u128]; + let arr = array![10_u128, 8, 6, 4, 2]; assert(lcm(arr.span()).unwrap() == 120, 'invalid result'); } #[test] #[available_gas(1000000000)] fn lcm_test_3() { - let arr = array![3_u128, 6_u128, 12_u128, 99_u128]; + let arr = array![3_u128, 6, 12, 99]; assert(lcm(arr.span()).unwrap() == 396, 'invalid result'); } #[test] #[available_gas(1000000000)] fn lcm_test_4() { - let arr = array![1_u128, 2_u128, 8_u128, 3_u128]; + let arr = array![1_u128, 2, 8, 3]; assert(lcm(arr.span()).unwrap() == 24, 'invalid result'); }