From 9f23221990358d4f48bd9c15f411e48dcd1ade88 Mon Sep 17 00:00:00 2001 From: enitrat Date: Thu, 29 Aug 2024 18:48:00 +0200 Subject: [PATCH 1/2] dev: migrate to sn foundry --- .tool-versions | 1 + README.md | 4 +- Scarb.lock | 36 +++++++++ packages/ascii/Scarb.toml | 7 +- .../ascii/src/tests/test_ascii_integer.cairo | 6 -- packages/bytes/Scarb.toml | 7 +- packages/bytes/src/lib.cairo | 4 + packages/bytes/src/test_utils.cairo | 1 + packages/bytes/src/tests/test_bytes.cairo | 41 ++-------- .../bytes/src/tests/test_bytes_store.cairo | 71 +++++++---------- packages/data_structures/Scarb.lock | 6 ++ packages/data_structures/Scarb.toml | 7 +- .../data_structures/src/tests/bit_array.cairo | 29 +------ .../src/tests/byte_appender.cairo | 60 -------------- .../src/tests/byte_array_ext.cairo | 2 - .../src/tests/byte_reader.cairo | 50 ------------ .../data_structures/src/tests/queue.cairo | 5 -- .../data_structures/src/tests/stack.cairo | 12 --- packages/data_structures/src/tests/vec.cairo | 32 ++------ packages/encoding/Scarb.toml | 7 +- .../encoding/src/tests/base64_felt_test.cairo | 5 -- packages/encoding/src/tests/base64_test.cairo | 10 --- .../encoding/src/tests/reversible_test.cairo | 18 ----- packages/encoding/src/tests/rlp_test.cairo | 36 --------- packages/linalg/Scarb.toml | 7 +- packages/linalg/src/tests/dot_test.cairo | 3 +- packages/linalg/src/tests/kron_test.cairo | 2 - packages/linalg/src/tests/norm_test.cairo | 4 - packages/macros/Scarb.toml | 7 +- packages/math/Scarb.toml | 7 +- .../math/src/tests/aliquot_sum_test.cairo | 7 -- .../src/tests/armstrong_number_test.cairo | 4 - .../src/tests/collatz_sequence_test.cairo | 3 - packages/math/src/tests/ed25519_test.cairo | 6 -- .../extended_euclidean_algorithm_test.cairo | 1 - packages/math/src/tests/fast_power_test.cairo | 2 - packages/math/src/tests/fast_root_test.cairo | 5 -- packages/math/src/tests/fibonacci_test.cairo | 1 - .../src/tests/gcd_of_n_numbers_test.cairo | 7 +- .../math/src/tests/is_power_of_two_test.cairo | 5 -- packages/math/src/tests/is_prime_test.cairo | 4 - packages/math/src/tests/karatsuba_test.cairo | 24 ------ .../src/tests/lcm_of_n_numbers_test.cairo | 7 -- packages/math/src/tests/math_test.cairo | 8 -- .../math/src/tests/mod_arithmetics_test.cairo | 14 ---- .../math/src/tests/perfect_number_test.cairo | 5 -- packages/math/src/tests/sha256_test.cairo | 4 - packages/math/src/tests/sha512_test.cairo | 3 - packages/math/src/tests/test_keccak256.cairo | 3 - .../math/src/tests/trigonometry_test.cairo | 9 --- .../math/src/tests/wad_ray_math_test.cairo | 18 ----- .../src/tests/zellers_congruence_test.cairo | 2 - packages/merkle_tree/Scarb.toml | 7 +- .../src/tests/merkle_tree_test.cairo | 2 - .../src/tests/storage_proof_test.cairo | 6 +- packages/numeric/Scarb.toml | 7 +- packages/numeric/src/tests/cumprod_test.cairo | 3 +- packages/numeric/src/tests/cumsum_test.cairo | 3 +- packages/numeric/src/tests/diff_test.cairo | 5 +- .../numeric/src/tests/integers_test.cairo | 5 -- .../src/tests/interpolate_fast_test.cairo | 10 +-- .../numeric/src/tests/interpolate_test.cairo | 9 +-- .../src/tests/trapezoidal_rule_test.cairo | 7 +- packages/searching/Scarb.toml | 7 +- .../tests/binary_search_closest_test.cairo | 9 --- .../src/tests/binary_search_test.cairo | 5 -- .../searching/src/tests/bm_search_test.cairo | 3 - .../searching/src/tests/dijkstra_test.cairo | 5 -- .../src/tests/levenshtein_distance_test.cairo | 7 -- packages/sorting/Scarb.toml | 7 +- .../sorting/src/tests/bubble_sort_test.cairo | 7 -- .../sorting/src/tests/merge_sort_test.cairo | 7 -- .../sorting/src/tests/quick_sort_test.cairo | 7 -- packages/storage/Scarb.toml | 7 +- packages/storage/src/tests/list_test.cairo | 78 ++++++------------- packages/utils/Scarb.toml | 8 ++ src/utils/Scarb.toml | 0 77 files changed, 214 insertions(+), 636 deletions(-) create mode 100644 packages/bytes/src/test_utils.cairo create mode 100644 packages/data_structures/Scarb.lock create mode 100644 src/utils/Scarb.toml diff --git a/.tool-versions b/.tool-versions index 045dc3e7..9c093844 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1,2 @@ scarb 2.7.0 +starknet-foundry 0.28.0 diff --git a/README.md b/README.md index 7cb0cebf..f3f7c945 100644 --- a/README.md +++ b/README.md @@ -104,12 +104,14 @@ scarb build ### Test +Install [Starknet-Foundry](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html) and then run the following command to run all the tests: + ```bash scarb test ``` Running a specific subset of tests ```bash -scarb test -f math +scarb test math ``` ### Format diff --git a/Scarb.lock b/Scarb.lock index ee9a715a..ae3efc53 100644 --- a/Scarb.lock +++ b/Scarb.lock @@ -6,6 +6,7 @@ name = "alexandria_ascii" version = "0.1.0" dependencies = [ "alexandria_data_structures", + "snforge_std", ] [[package]] @@ -14,6 +15,7 @@ version = "0.1.0" dependencies = [ "alexandria_data_structures", "alexandria_math", + "snforge_std", ] [[package]] @@ -21,6 +23,7 @@ name = "alexandria_data_structures" version = "0.2.0" dependencies = [ "alexandria_encoding", + "snforge_std", ] [[package]] @@ -30,6 +33,7 @@ dependencies = [ "alexandria_bytes", "alexandria_math", "alexandria_numeric", + "snforge_std", ] [[package]] @@ -37,19 +41,29 @@ name = "alexandria_linalg" version = "0.1.0" dependencies = [ "alexandria_math", + "snforge_std", ] [[package]] name = "alexandria_macros" version = "0.1.0" +dependencies = [ + "snforge_std", +] [[package]] name = "alexandria_math" version = "0.2.1" +dependencies = [ + "snforge_std", +] [[package]] name = "alexandria_merkle_tree" version = "0.1.0" +dependencies = [ + "snforge_std", +] [[package]] name = "alexandria_numeric" @@ -57,6 +71,7 @@ version = "0.1.0" dependencies = [ "alexandria_math", "alexandria_searching", + "snforge_std", ] [[package]] @@ -64,6 +79,7 @@ name = "alexandria_searching" version = "0.1.0" dependencies = [ "alexandria_data_structures", + "snforge_std", ] [[package]] @@ -71,12 +87,32 @@ name = "alexandria_sorting" version = "0.1.0" dependencies = [ "alexandria_data_structures", + "snforge_std", ] [[package]] name = "alexandria_storage" version = "0.3.0" +dependencies = [ + "snforge_std", +] [[package]] name = "alexandria_utils" version = "0.1.0" +dependencies = [ + "snforge_std", +] + +[[package]] +name = "snforge_scarb_plugin" +version = "0.1.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea" + +[[package]] +name = "snforge_std" +version = "0.28.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea" +dependencies = [ + "snforge_scarb_plugin", +] diff --git a/packages/ascii/Scarb.toml b/packages/ascii/Scarb.toml index d0a39062..806a6b5a 100644 --- a/packages/ascii/Scarb.toml +++ b/packages/ascii/Scarb.toml @@ -12,4 +12,9 @@ fmt.workspace = true alexandria_data_structures = { path = "../data_structures" } [dev-dependencies] -cairo_test.workspace = true \ No newline at end of file +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/ascii/src/tests/test_ascii_integer.cairo b/packages/ascii/src/tests/test_ascii_integer.cairo index 9ada074d..84cda196 100644 --- a/packages/ascii/src/tests/test_ascii_integer.cairo +++ b/packages/ascii/src/tests/test_ascii_integer.cairo @@ -2,7 +2,6 @@ use alexandria_ascii::ToAsciiTrait; use core::num::traits::Bounded; #[test] -#[available_gas(2000000000)] fn u256_to_ascii() { // ------------------------------ max u256 test ----------------------------- // // max u256 int in cairo is GitHub Copilot: The maximum u256 number in Cairo is ` @@ -32,7 +31,6 @@ fn u256_to_ascii() { } #[test] -#[available_gas(2000000)] fn u128_to_ascii() { // ------------------------------ max u128 test ----------------------------- // // max u128 int in cairo is 340282366920938463463374607431768211455 @@ -55,7 +53,6 @@ fn u128_to_ascii() { } #[test] -#[available_gas(2000000)] fn u64_to_ascii() { // ------------------------------ max u64 test ------------------------------ // let num: u64 = Bounded::MAX; @@ -66,7 +63,6 @@ fn u64_to_ascii() { } #[test] -#[available_gas(2000000)] fn u32_to_ascii() { // ------------------------------ max u32 test ------------------------------ // let num: u32 = Bounded::MAX; @@ -77,7 +73,6 @@ fn u32_to_ascii() { } #[test] -#[available_gas(2000000)] fn u16_to_ascii() { // ------------------------------ max u16 test ------------------------------ // let num: u16 = Bounded::MAX; @@ -88,7 +83,6 @@ fn u16_to_ascii() { } #[test] -#[available_gas(2000000)] fn u8_to_ascii() { // ------------------------------- max u8 test ------------------------------ // let num: u8 = Bounded::MAX; diff --git a/packages/bytes/Scarb.toml b/packages/bytes/Scarb.toml index b10115b7..6efec30f 100644 --- a/packages/bytes/Scarb.toml +++ b/packages/bytes/Scarb.toml @@ -14,4 +14,9 @@ alexandria_data_structures = { path = "../data_structures" } starknet.workspace = true [dev-dependencies] -cairo_test.workspace = true +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/bytes/src/lib.cairo b/packages/bytes/src/lib.cairo index 7bac6d07..6645ab40 100644 --- a/packages/bytes/src/lib.cairo +++ b/packages/bytes/src/lib.cairo @@ -1,8 +1,12 @@ pub mod bytes; pub mod storage; +#[cfg(target: 'test')] +mod test_utils; + #[cfg(test)] mod tests; + pub mod utils; pub use bytes::{Bytes, BytesTrait, BytesIndex}; diff --git a/packages/bytes/src/test_utils.cairo b/packages/bytes/src/test_utils.cairo new file mode 100644 index 00000000..7642d8a6 --- /dev/null +++ b/packages/bytes/src/test_utils.cairo @@ -0,0 +1 @@ +use alexandria_bytes::Bytes; diff --git a/packages/bytes/src/tests/test_bytes.cairo b/packages/bytes/src/tests/test_bytes.cairo index b7146a5b..39b8cd3a 100644 --- a/packages/bytes/src/tests/test_bytes.cairo +++ b/packages/bytes/src/tests/test_bytes.cairo @@ -3,7 +3,6 @@ use alexandria_bytes::{Bytes, BytesTrait, BytesIndex}; use starknet::ContractAddress; #[test] -#[available_gas(20000000)] fn test_bytes_zero() { let bytes = BytesTrait::zero(1); assert_eq!(bytes.size(), 1); @@ -22,15 +21,13 @@ fn test_bytes_zero() { } #[test] -#[available_gas(200000000)] -#[should_panic(expected: ('update out of bound',))] +#[should_panic(expected: 'update out of bound')] fn test_bytes_update_panic() { let mut bytes = BytesTrait::new_empty(); bytes.update_at(0, 0x01); } #[test] -#[available_gas(200000000)] fn test_bytes_update() { let mut bytes = BytesTrait::new(5, array![0x01020304050000000000000000000000]); @@ -77,7 +74,6 @@ fn test_bytes_update() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_u128_packed() { let array = array![ 0x01020304050607080910111213141516, @@ -109,8 +105,7 @@ fn test_bytes_read_u128_packed() { } #[test] -#[available_gas(20000000)] -#[should_panic(expected: ('out of bound',))] +#[should_panic(expected: 'out of bound')] fn test_bytes_read_u128_packed_out_of_bound() { let array = array![ 0x01020304050607080910111213141516, @@ -124,8 +119,7 @@ fn test_bytes_read_u128_packed_out_of_bound() { } #[test] -#[available_gas(20000000)] -#[should_panic(expected: ('too large',))] +#[should_panic(expected: 'too large')] fn test_bytes_read_u128_packed_too_large() { let array = array![ 0x01020304050607080910111213141516, @@ -139,7 +133,6 @@ fn test_bytes_read_u128_packed_too_large() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_u128_array_packed() { let array = array![ 0x01020304050607080910111213141516, @@ -164,8 +157,7 @@ fn test_bytes_read_u128_array_packed() { } #[test] -#[available_gas(20000000)] -#[should_panic(expected: ('out of bound',))] +#[should_panic(expected: 'out of bound')] fn test_bytes_read_u128_array_packed_out_of_bound() { let array = array![ 0x01020304050607080910111213141516, @@ -179,8 +171,7 @@ fn test_bytes_read_u128_array_packed_out_of_bound() { } #[test] -#[available_gas(20000000)] -#[should_panic(expected: ('too large',))] +#[should_panic(expected: 'too large')] fn test_bytes_read_u128_array_packed_too_large() { let array = array![ 0x01020304050607080910111213141516, @@ -194,7 +185,6 @@ fn test_bytes_read_u128_array_packed_too_large() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_felt252_packed() { let array = array![ 0x01020304050607080910111213141516, @@ -210,8 +200,7 @@ fn test_bytes_read_felt252_packed() { } #[test] -#[available_gas(20000000)] -#[should_panic(expected: ('out of bound',))] +#[should_panic(expected: 'out of bound')] fn test_bytes_read_felt252_packed_out_of_bound() { let array = array![ 0x01020304050607080910111213141516, @@ -225,8 +214,7 @@ fn test_bytes_read_felt252_packed_out_of_bound() { } #[test] -#[available_gas(20000000)] -#[should_panic(expected: ('too large',))] +#[should_panic(expected: 'too large')] fn test_bytes_read_felt252_packed_too_large() { let array = array![ 0x01020304050607080910111213141516, @@ -240,7 +228,6 @@ fn test_bytes_read_felt252_packed_too_large() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_u8() { let array = array![ 0x01020304050607080910111213141516, @@ -256,7 +243,6 @@ fn test_bytes_read_u8() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_u16() { let array = array![ 0x01020304050607080910111213141516, @@ -272,7 +258,6 @@ fn test_bytes_read_u16() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_u32() { let array = array![ 0x01020304050607080910111213141516, @@ -288,7 +273,6 @@ fn test_bytes_read_u32() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_usize() { let array = array![ 0x01020304050607080910111213141516, @@ -304,7 +288,6 @@ fn test_bytes_read_usize() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_u64() { let array = array![ 0x01020304050607080910111213141516, @@ -320,7 +303,6 @@ fn test_bytes_read_u64() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_u128() { let array = array![ 0x01020304050607080910111213141516, @@ -336,7 +318,6 @@ fn test_bytes_read_u128() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_u256() { let array = array![ 0x01020304050607080910111213141516, @@ -353,7 +334,6 @@ fn test_bytes_read_u256() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_bytes31() { let bytes: Bytes = BytesTrait::new( 31, array![0x0102030405060708090a0b0c0d0e0f10, 0x1112131415161718191a1b1c1d1e1f00] @@ -367,7 +347,6 @@ fn test_bytes_read_bytes31() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_u256_array() { let array = array![ 0x01020304050607080910111213141516, @@ -391,7 +370,6 @@ fn test_bytes_read_u256_array() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_address() { let array = array![ 0x01020304050607080910111213140154, @@ -408,7 +386,6 @@ fn test_bytes_read_address() { } #[test] -#[available_gas(20000000)] fn test_bytes_read_bytes() { let array = array![ 0x01020304050607080910111213140154, @@ -448,7 +425,6 @@ fn test_bytes_read_bytes() { } #[test] -#[available_gas(20000000)] fn test_bytes_append() { let mut bytes = BytesTrait::new_empty(); @@ -537,7 +513,6 @@ fn test_bytes_append() { } #[test] -#[available_gas(20000000)] fn test_bytes_concat() { let array: Array = array![ 0x10111213141516171810111213141516, @@ -609,7 +584,6 @@ fn test_bytes_concat() { } #[test] -#[available_gas(20000000)] fn test_bytes_keccak() { // Calculating keccak by Python // from Crypto.Hash import keccak @@ -651,7 +625,6 @@ fn test_bytes_keccak() { } #[test] -#[available_gas(20000000000)] fn test_bytes_sha256() { // empty let bytes = BytesTrait::new_empty(); diff --git a/packages/bytes/src/tests/test_bytes_store.cairo b/packages/bytes/src/tests/test_bytes_store.cairo index b4eca5c6..fb3e9291 100644 --- a/packages/bytes/src/tests/test_bytes_store.cairo +++ b/packages/bytes/src/tests/test_bytes_store.cairo @@ -1,13 +1,18 @@ -use alexandria_bytes::Bytes; +use alexandria_bytes::utils::{BytesDebug, BytesDisplay}; +use alexandria_bytes::{Bytes, BytesTrait, BytesStore}; +use snforge_std::{declare, DeclareResultTrait, ContractClassTrait}; +use starknet::syscalls::deploy_syscall; +use starknet::{ClassHash, ContractAddress, SyscallResultTrait,}; #[starknet::interface] -trait IABytesStore { +pub(crate) trait IABytesStore { fn get_bytes(self: @TContractState) -> Bytes; fn set_bytes(ref self: TContractState, bytes: Bytes); } + #[starknet::contract] -mod ABytesStore { +pub(crate) mod ABytesStore { use alexandria_bytes::{Bytes, BytesStore}; #[storage] @@ -27,45 +32,27 @@ mod ABytesStore { } } -#[cfg(test)] -mod tests { - use alexandria_bytes::utils::{BytesDebug, BytesDisplay}; - use alexandria_bytes::{Bytes, BytesTrait, BytesStore}; - use starknet::syscalls::deploy_syscall; - use starknet::{ClassHash, ContractAddress, SyscallResultTrait,}; - use super::{ABytesStore, IABytesStoreDispatcher, IABytesStoreDispatcherTrait}; - - fn deploy() -> IABytesStoreDispatcher { - let class_hash: ClassHash = ABytesStore::TEST_CLASS_HASH.try_into().unwrap(); - let ctor_data: Array = Default::default(); - let (addr, _) = deploy_syscall(class_hash, 0, ctor_data.span(), false).unwrap_syscall(); - IABytesStoreDispatcher { contract_address: addr } - } - - #[test] - fn test_deploy() { - let contract = deploy(); - assert_eq!(contract.get_bytes(), BytesTrait::new_empty()); - } +#[test] +fn test_deploy() { + let contract = ABytesStore::contract_state_for_testing(); + assert_eq!(contract.get_bytes(), BytesTrait::new_empty()); +} - #[test] - fn test_bytes_storage_32_bytes() { - let contract = deploy(); - let bytes = BytesTrait::new(32, array![0x01020304050607080910, 0x11121314151617181920]); - contract.set_bytes(bytes.clone()); - assert_eq!(contract.get_bytes(), bytes); - } +#[test] +fn test_bytes_storage_32_bytes() { + let mut contract = ABytesStore::contract_state_for_testing(); + let bytes = BytesTrait::new(32, array![0x01020304050607080910, 0x11121314151617181920]); + contract.set_bytes(bytes.clone()); + assert_eq!(contract.get_bytes(), bytes); +} - #[test] - fn test_bytes_storage_40_bytes() { - let contract = deploy(); - let bytes = BytesTrait::new( - 40, - array![ - 0x01020304050607080910, 0x11121314151617181920, 0x21222324252627280000000000000000 - ] - ); - contract.set_bytes(bytes.clone()); - assert_eq!(contract.get_bytes(), bytes); - } +#[test] +fn test_bytes_storage_40_bytes() { + let mut contract = ABytesStore::contract_state_for_testing(); + let bytes = BytesTrait::new( + 40, + array![0x01020304050607080910, 0x11121314151617181920, 0x21222324252627280000000000000000] + ); + contract.set_bytes(bytes.clone()); + assert_eq!(contract.get_bytes(), bytes); } diff --git a/packages/data_structures/Scarb.lock b/packages/data_structures/Scarb.lock new file mode 100644 index 00000000..b3a9ad90 --- /dev/null +++ b/packages/data_structures/Scarb.lock @@ -0,0 +1,6 @@ +# Code generated by scarb DO NOT EDIT. +version = 1 + +[[package]] +name = "alexandria_data_structures" +version = "0.1.0" diff --git a/packages/data_structures/Scarb.toml b/packages/data_structures/Scarb.toml index b484f623..2caa04d7 100644 --- a/packages/data_structures/Scarb.toml +++ b/packages/data_structures/Scarb.toml @@ -12,4 +12,9 @@ fmt.workspace = true alexandria_encoding = { path = "../encoding" } [dev-dependencies] -cairo_test.workspace = true +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/data_structures/src/tests/bit_array.cairo b/packages/data_structures/src/tests/bit_array.cairo index c2feb95c..cea28359 100644 --- a/packages/data_structures/src/tests/bit_array.cairo +++ b/packages/data_structures/src/tests/bit_array.cairo @@ -5,7 +5,6 @@ use core::integer::u512; use core::num::traits::Bounded; #[test] -#[available_gas(30000000)] fn test_append_bit() { let mut ba: BitArray = Default::default(); let mut c = 250; @@ -23,7 +22,6 @@ fn test_append_bit() { } #[test] -#[available_gas(20000000)] fn test_at() { let ba = sample_bit_array(); let mut index: usize = 0; @@ -39,14 +37,12 @@ fn test_at() { } #[test] -#[available_gas(2000000)] fn test_at_none() { let ba = sample_bit_array(); assert!(ba.at(8 * 16).is_none(), "expected none"); } #[test] -#[available_gas(20000000)] fn test_index() { let ba = sample_bit_array(); assert!(ba[0] == true, "expected true"); @@ -54,15 +50,13 @@ fn test_index() { } #[test] -#[available_gas(20000000)] -#[should_panic(expected: ('Index out of bounds',))] +#[should_panic(expected: 'Index out of bounds')] fn test_index_fail() { let ba = sample_bit_array(); ba[8 * 16]; } #[test] -#[available_gas(2000000)] fn test_len() { let mut ba = sample_bit_array(); let expected = 8 * 16; @@ -74,35 +68,30 @@ fn test_len() { } #[test] -#[available_gas(2000000)] fn test_pop_front() { let mut ba = sample_bit_array(); assert!(ba.pop_front() == Option::Some(true), "expected (some) true"); } #[test] -#[available_gas(2000000)] fn test_pop_front_empty() { let mut ba: BitArray = Default::default(); assert!(ba.pop_front() == Option::None, "expected none"); } #[test] -#[available_gas(20000000)] fn test_read_word_be() { let mut ba = sample_bit_array(); assert_eq!(ba.read_word_be(length: 128).unwrap(), Bounded::::MAX.into() - 1); } #[test] -#[available_gas(20000000)] fn test_read_word_le() { let mut ba = sample_bit_array(); assert_eq!(ba.read_word_le(length: 128).unwrap(), 0x7fffffffffffffffffffffffffffffff); } #[test] -#[available_gas(40000000)] fn test_read_word_be_u256() { let mut ba = sample_bit_array(); let low = 0x101112131415161718191a1b1c1d1e1f_u128; @@ -112,7 +101,6 @@ fn test_read_word_be_u256() { } #[test] -#[available_gas(40000000)] fn test_read_word_le_u256() { let mut ba = sample_bit_array(); let low = 0x7fffffffffffffffffffffffffffffff_u128; @@ -122,7 +110,6 @@ fn test_read_word_le_u256() { } #[test] -#[available_gas(70000000)] fn test_read_word_be_u512() { let mut ba = sample_bit_array(); let limb0 = 0x101112131415161718191a1b1c1d1e1f_u128; @@ -136,7 +123,6 @@ fn test_read_word_be_u512() { } #[test] -#[available_gas(70000000)] fn test_read_word_le_u512() { let mut ba = sample_bit_array(); let limb1 = 0x101112131415161718191a1b1c1d1e1f_u128; @@ -150,7 +136,6 @@ fn test_read_word_le_u512() { } #[test] -#[available_gas(20000000)] fn test_read_word_be_half() { let mut ba = sample_bit_array(); assert!(ba.read_word_be(64).unwrap() == 0xffffffffffffffff, "unexpected result"); @@ -158,7 +143,6 @@ fn test_read_word_be_half() { } #[test] -#[available_gas(20000000)] fn test_read_word_le_half() { let mut ba = sample_bit_array(); assert!(ba.read_word_le(64).unwrap() == 0xffffffffffffffff, "unexpected result"); @@ -166,7 +150,6 @@ fn test_read_word_le_half() { } #[test] -#[available_gas(20000000)] fn test_write_word_be() { let mut ba: BitArray = Default::default(); ba.write_word_be(Bounded::::MAX.into() - 2, 128); @@ -174,7 +157,6 @@ fn test_write_word_be() { } #[test] -#[available_gas(20000000)] fn test_write_word_be_half() { let mut ba: BitArray = Default::default(); ba.write_word_be(Bounded::::MAX.into() - 3, 64); @@ -182,7 +164,6 @@ fn test_write_word_be_half() { } #[test] -#[available_gas(20000000)] fn test_write_word_le() { let mut ba: BitArray = Default::default(); ba.write_word_le(Bounded::::MAX.into() - 4, 128); @@ -190,7 +171,6 @@ fn test_write_word_le() { } #[test] -#[available_gas(20000000)] fn test_write_word_le_half() { let mut ba: BitArray = Default::default(); ba.write_word_le(Bounded::::MAX.into() - 5, 64); @@ -198,7 +178,6 @@ fn test_write_word_le_half() { } #[test] -#[available_gas(40000000)] fn test_write_word_be_u256() { let mut ba: BitArray = Default::default(); let expected = u256 { low: Bounded::MAX - 1, high: Bounded::MAX - 2 }; @@ -207,7 +186,6 @@ fn test_write_word_be_u256() { } #[test] -#[available_gas(40000000)] fn test_write_word_le_u256() { let mut ba: BitArray = Default::default(); let expected = u256 { low: Bounded::MAX - 1, high: Bounded::MAX - 2 }; @@ -216,7 +194,6 @@ fn test_write_word_le_u256() { } #[test] -#[available_gas(80000000)] fn test_write_word_be_u512() { let mut ba: BitArray = Default::default(); let limb0 = Bounded::::MAX; @@ -229,7 +206,6 @@ fn test_write_word_be_u512() { } #[test] -#[available_gas(80000000)] fn test_write_word_le_u512() { let mut ba: BitArray = Default::default(); let limb0 = Bounded::::MAX; @@ -242,7 +218,6 @@ fn test_write_word_le_u512() { } #[test] -#[available_gas(2000000000)] fn test_stress_test() { let mut ba: BitArray = Default::default(); let mut index = 0; @@ -264,7 +239,6 @@ fn test_stress_test() { } #[test] -#[available_gas(100000)] fn test_serde_serialize() { let mut out = array![]; let ba = sample_bit_array(); @@ -281,7 +255,6 @@ fn test_serde_serialize() { } #[test] -#[available_gas(300000000)] fn test_serde_ser_deser() { let mut ba: BitArray = Default::default(); let test: felt252 = 0x101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e; diff --git a/packages/data_structures/src/tests/byte_appender.cairo b/packages/data_structures/src/tests/byte_appender.cairo index fb70058b..51ff4e8c 100644 --- a/packages/data_structures/src/tests/byte_appender.cairo +++ b/packages/data_structures/src/tests/byte_appender.cairo @@ -6,7 +6,6 @@ use alexandria_data_structures::tests::byte_reader::{ use core::integer::u512; #[test] -#[available_gas(1000000)] fn test_append_u16() { let mut ba: ByteArray = Default::default(); ba.append_u16(0x0102_u16); @@ -17,7 +16,6 @@ fn test_append_u16() { } #[test] -#[available_gas(1000000)] fn test_append_u16_arr() { let mut ba: Array = array![]; ba.append_u16(0x0102_u16); @@ -28,7 +26,6 @@ fn test_append_u16_arr() { } #[test] -#[available_gas(1000000)] fn test_append_u16_le() { let mut ba: ByteArray = Default::default(); ba.append_u16_le(0x0201_u16); @@ -39,7 +36,6 @@ fn test_append_u16_le() { } #[test] -#[available_gas(1000000)] fn test_append_u16_le_arr() { let mut ba: Array = array![]; ba.append_u16_le(0x0201_u16); @@ -50,7 +46,6 @@ fn test_append_u16_le_arr() { } #[test] -#[available_gas(1000000)] fn test_append_u32() { let mut ba: ByteArray = Default::default(); ba.append_u32(0x01020304_u32); @@ -59,7 +54,6 @@ fn test_append_u32() { } #[test] -#[available_gas(1000000)] fn test_append_u32_arr() { let mut ba: Array = array![]; ba.append_u32(0x01020304_u32); @@ -68,7 +62,6 @@ fn test_append_u32_arr() { } #[test] -#[available_gas(1000000)] fn test_append_u32_le() { let mut ba: ByteArray = Default::default(); ba.append_u32_le(0x04030201_u32); @@ -77,7 +70,6 @@ fn test_append_u32_le() { } #[test] -#[available_gas(1000000)] fn test_append_u32_le_arr() { let mut ba: Array = array![]; ba.append_u32_le(0x04030201_u32); @@ -86,7 +78,6 @@ fn test_append_u32_le_arr() { } #[test] -#[available_gas(1000000)] fn test_append_u64() { let mut ba: ByteArray = Default::default(); ba.append_u64(0x0102030405060708_u64); @@ -95,7 +86,6 @@ fn test_append_u64() { } #[test] -#[available_gas(1000000)] fn test_append_u64_arr() { let mut ba: Array = array![]; ba.append_u64(0x0102030405060708_u64); @@ -104,7 +94,6 @@ fn test_append_u64_arr() { } #[test] -#[available_gas(1000000)] fn test_append_u64_le() { let mut ba: ByteArray = Default::default(); ba.append_u64_le(0x0807060504030201_u64); @@ -113,7 +102,6 @@ fn test_append_u64_le() { } #[test] -#[available_gas(1000000)] fn test_append_u64_le_arr() { let mut ba: Array = array![]; ba.append_u64_le(0x0807060504030201_u64); @@ -122,7 +110,6 @@ fn test_append_u64_le_arr() { } #[test] -#[available_gas(1000000)] fn test_append_u128() { let mut ba: ByteArray = Default::default(); ba.append_u128(0x0102030405060708090a0b0c0d0e0f10_u128); @@ -131,7 +118,6 @@ fn test_append_u128() { } #[test] -#[available_gas(10000000)] fn test_append_u128_arr() { let mut ba: Array = array![]; ba.append_u128(0x0102030405060708090a0b0c0d0e0f10_u128); @@ -140,7 +126,6 @@ fn test_append_u128_arr() { } #[test] -#[available_gas(1000000)] fn test_append_u128_le() { let mut ba: ByteArray = Default::default(); ba.append_u128_le(0x100f0e0d0c0b0a090807060504030201_u128); @@ -149,7 +134,6 @@ fn test_append_u128_le() { } #[test] -#[available_gas(1000000)] fn test_append_u128_le_arr() { let mut ba: Array = array![]; ba.append_u128_le(0x100f0e0d0c0b0a090807060504030201_u128); @@ -158,7 +142,6 @@ fn test_append_u128_le_arr() { } #[test] -#[available_gas(1000000)] fn test_append_u256() { let mut ba: ByteArray = Default::default(); let word = u256 { @@ -169,7 +152,6 @@ fn test_append_u256() { } #[test] -#[available_gas(10000000)] fn test_append_u256_arr() { let mut ba: Array = array![]; let word = u256 { @@ -180,7 +162,6 @@ fn test_append_u256_arr() { } #[test] -#[available_gas(1000000)] fn test_append_u256_le() { let mut ba: ByteArray = Default::default(); let word = u256 { @@ -191,7 +172,6 @@ fn test_append_u256_le() { } #[test] -#[available_gas(1000000)] fn test_append_u256_le_arr() { let mut ba: Array = array![]; let word = u256 { @@ -202,7 +182,6 @@ fn test_append_u256_le_arr() { } #[test] -#[available_gas(1000000)] fn test_append_u512() { let test64 = u512 { limb3: 0x0102030405060708090a0b0c0d0e0f10_u128, @@ -217,7 +196,6 @@ fn test_append_u512() { } #[test] -#[available_gas(10000000)] fn test_append_u512_arr() { let test64 = u512 { limb3: 0x0102030405060708090a0b0c0d0e0f10_u128, @@ -232,7 +210,6 @@ fn test_append_u512_arr() { } #[test] -#[available_gas(10000000)] fn test_append_u512_le() { let test64 = u512 { limb0: 0x100f0e0d0c0b0a090807060504030201_u128, @@ -247,7 +224,6 @@ fn test_append_u512_le() { } #[test] -#[available_gas(10000000)] fn test_append_u512_le_arr() { let test64 = u512 { limb0: 0x100f0e0d0c0b0a090807060504030201_u128, @@ -262,7 +238,6 @@ fn test_append_u512_le_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i8() { let mut ba1: ByteArray = Default::default(); ba1.append_i8(127_i8); @@ -272,7 +247,6 @@ fn test_append_i8() { } #[test] -#[available_gas(1000000)] fn test_append_i8_arr() { let mut ba1: Array = array![]; ba1.append_i8(127_i8); @@ -282,7 +256,6 @@ fn test_append_i8_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i8_neg() { let mut ba1: ByteArray = Default::default(); ba1.append_i8(-128_i8); @@ -292,7 +265,6 @@ fn test_append_i8_neg() { } #[test] -#[available_gas(1000000)] fn test_append_i8_neg_arr() { let mut ba1: Array = array![]; ba1.append_i8(-128_i8); @@ -302,7 +274,6 @@ fn test_append_i8_neg_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i16() { let mut ba1: ByteArray = Default::default(); ba1.append_i16(0x0102_i16); @@ -313,7 +284,6 @@ fn test_append_i16() { } #[test] -#[available_gas(1000000)] fn test_append_i16_arr() { let mut ba1: Array = array![]; ba1.append_i16(0x0102_i16); @@ -324,7 +294,6 @@ fn test_append_i16_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i16_le() { let mut ba1: ByteArray = Default::default(); ba1.append_i16_le(0x0201_i16); @@ -335,7 +304,6 @@ fn test_append_i16_le() { } #[test] -#[available_gas(1000000)] fn test_append_i16_le_arr() { let mut ba1: Array = array![]; ba1.append_i16_le(0x0201_i16); @@ -346,7 +314,6 @@ fn test_append_i16_le_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i16_neg() { let mut ba1: ByteArray = Default::default(); ba1.append_i16(-1_i16); @@ -361,7 +328,6 @@ fn test_append_i16_neg() { } #[test] -#[available_gas(1000000)] fn test_append_i16_neg_arr() { let mut ba1: Array = array![]; ba1.append_i16(-1_i16); @@ -376,7 +342,6 @@ fn test_append_i16_neg_arr() { } #[test] -#[available_gas(10000000)] fn test_append_i16_le_neg() { let mut ba1: ByteArray = Default::default(); ba1.append_i16_le(-1_i16); @@ -391,7 +356,6 @@ fn test_append_i16_le_neg() { } #[test] -#[available_gas(10000000)] fn test_append_i16_le_neg_arr() { let mut ba1: Array = array![]; ba1.append_i16_le(-1_i16); @@ -406,7 +370,6 @@ fn test_append_i16_le_neg_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i32() { let mut ba: ByteArray = Default::default(); ba.append_i32(0x01020304_i32); @@ -415,7 +378,6 @@ fn test_append_i32() { } #[test] -#[available_gas(1000000)] fn test_append_i32_arr() { let mut ba: Array = array![]; ba.append_i32(0x01020304_i32); @@ -424,7 +386,6 @@ fn test_append_i32_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i32_le() { let mut ba: ByteArray = Default::default(); ba.append_i32_le(0x04030201_i32); @@ -433,7 +394,6 @@ fn test_append_i32_le() { } #[test] -#[available_gas(1000000)] fn test_append_i32_le_arr() { let mut ba: Array = array![]; ba.append_i32_le(0x04030201_i32); @@ -442,7 +402,6 @@ fn test_append_i32_le_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i32_neg() { let mut ba: ByteArray = Default::default(); ba.append_i32(-1_i32); @@ -452,7 +411,6 @@ fn test_append_i32_neg() { assert_eq!(ba, test_byte_array_16_neg()); } #[test] -#[available_gas(1000000)] fn test_append_i32_neg_arr() { let mut ba: Array = array![]; ba.append_i32(-1_i32); @@ -463,7 +421,6 @@ fn test_append_i32_neg_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i32_le_neg() { let mut ba: ByteArray = Default::default(); ba.append_i32_le(-1_i32); @@ -474,7 +431,6 @@ fn test_append_i32_le_neg() { } #[test] -#[available_gas(1000000)] fn test_append_i32_le_neg_arr() { let mut ba: Array = array![]; ba.append_i32_le(-1_i32); @@ -485,7 +441,6 @@ fn test_append_i32_le_neg_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i64() { let mut ba: ByteArray = Default::default(); ba.append_i64(0x0102030405060708_i64); @@ -494,7 +449,6 @@ fn test_append_i64() { } #[test] -#[available_gas(1000000)] fn test_append_i64_arr() { let mut ba: Array = array![]; ba.append_i64(0x0102030405060708_i64); @@ -503,7 +457,6 @@ fn test_append_i64_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i64_le() { let mut ba: ByteArray = Default::default(); ba.append_i64_le(0x0807060504030201_i64); @@ -512,7 +465,6 @@ fn test_append_i64_le() { } #[test] -#[available_gas(1000000)] fn test_append_i64_le_arr() { let mut ba: Array = array![]; ba.append_i64_le(0x0807060504030201_i64); @@ -521,7 +473,6 @@ fn test_append_i64_le_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i64_neg() { let mut ba: ByteArray = Default::default(); ba.append_i64(-1_i64); @@ -530,7 +481,6 @@ fn test_append_i64_neg() { } #[test] -#[available_gas(1000000)] fn test_append_i64_neg_arr() { let mut ba: Array = array![]; ba.append_i64(-1_i64); @@ -539,7 +489,6 @@ fn test_append_i64_neg_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i64_le_neg() { let mut ba: ByteArray = Default::default(); ba.append_i64_le(-1_i64); @@ -548,7 +497,6 @@ fn test_append_i64_le_neg() { } #[test] -#[available_gas(1000000)] fn test_append_i64_le_neg_arr() { let mut ba: Array = array![]; ba.append_i64_le(-1_i64); @@ -557,7 +505,6 @@ fn test_append_i64_le_neg_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i128() { let mut ba: ByteArray = Default::default(); ba.append_i128(0x0102030405060708090a0b0c0d0e0f10_i128); @@ -566,7 +513,6 @@ fn test_append_i128() { } #[test] -#[available_gas(10000000)] fn test_append_i128_arr() { let mut ba: Array = array![]; ba.append_i128(0x0102030405060708090a0b0c0d0e0f10_i128); @@ -575,7 +521,6 @@ fn test_append_i128_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i128_le() { let mut ba: ByteArray = Default::default(); ba.append_i128_le(0x100f0e0d0c0b0a090807060504030201_i128); @@ -584,7 +529,6 @@ fn test_append_i128_le() { } #[test] -#[available_gas(1000000)] fn test_append_i128_le_arr() { let mut ba: Array = array![]; ba.append_i128_le(0x100f0e0d0c0b0a090807060504030201_i128); @@ -593,7 +537,6 @@ fn test_append_i128_le_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i128_neg() { let mut ba: ByteArray = Default::default(); ba.append_i128(-2_i128); @@ -601,7 +544,6 @@ fn test_append_i128_neg() { } #[test] -#[available_gas(1000000)] fn test_append_i128_neg_arr() { let mut ba: Array = array![]; ba.append_i128(-2_i128); @@ -609,7 +551,6 @@ fn test_append_i128_neg_arr() { } #[test] -#[available_gas(1000000)] fn test_append_i128_le_neg() { let mut ba: ByteArray = Default::default(); ba.append_i128_le(-1329227995784915872903807060280344577_i128); @@ -617,7 +558,6 @@ fn test_append_i128_le_neg() { } #[test] -#[available_gas(1000000)] fn test_append_i128_le_neg_arr() { let mut ba: Array = array![]; ba.append_i128_le(-1329227995784915872903807060280344577_i128); diff --git a/packages/data_structures/src/tests/byte_array_ext.cairo b/packages/data_structures/src/tests/byte_array_ext.cairo index ce74a13a..c29cd6b6 100644 --- a/packages/data_structures/src/tests/byte_array_ext.cairo +++ b/packages/data_structures/src/tests/byte_array_ext.cairo @@ -1,7 +1,6 @@ use alexandria_data_structures::byte_array_ext::{ByteArrayIntoArrayU8, SpanU8IntoBytearray}; #[test] -#[available_gas(1000000)] fn test_span_u8_into_byte_array() { let array: Array = array![1, 2, 3, 4, 5, 6, 7, 8,]; let ba: ByteArray = array.span().into(); @@ -13,7 +12,6 @@ fn test_span_u8_into_byte_array() { } #[test] -#[available_gas(10000000)] fn test_byte_array_into_array_u8() { let array: Array = test_byte_array_64().into(); let mut index = 0_usize; diff --git a/packages/data_structures/src/tests/byte_reader.cairo b/packages/data_structures/src/tests/byte_reader.cairo index 965ad745..4f5e5d06 100644 --- a/packages/data_structures/src/tests/byte_reader.cairo +++ b/packages/data_structures/src/tests/byte_reader.cairo @@ -2,203 +2,174 @@ use alexandria_data_structures::byte_reader::ByteReader; use core::integer::u512; #[test] -#[available_gas(1000000)] fn test_word_u16() { let word = test_byte_array_64().word_u16(62).unwrap(); assert!(word == 0x3f40_u16, "word u16 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u16_arr() { let word = test_array_64().word_u16(62).unwrap(); assert!(word == 0x3f40_u16, "word u16 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u16_le() { let word = test_byte_array_64().word_u16_le(62).unwrap(); assert!(word == 0x403f_u16, "word u16 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u16_le_arr() { let word = test_array_64().word_u16_le(62).unwrap(); assert!(word == 0x403f_u16, "word u16 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u16_none() { let is_none = test_byte_array_64().word_u16(63).is_none(); assert!(is_none, "word u16 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u16_none_arr() { let is_none = test_array_64().word_u16(63).is_none(); assert!(is_none, "word u16 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u16_le_none() { let is_none = test_byte_array_64().word_u16_le(63).is_none(); assert!(is_none, "word u16 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u16_le_none_arr() { let is_none = test_array_64().word_u16_le(63).is_none(); assert!(is_none, "word u16 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u32() { let word = test_byte_array_64().word_u32(60).unwrap(); assert!(word == 0x3d3e3f40_u32, "word u32 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u32_arr() { let word = test_array_64().word_u32(60).unwrap(); assert!(word == 0x3d3e3f40_u32, "word u32 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u32_le() { let word = test_byte_array_64().word_u32_le(60).unwrap(); assert!(word == 0x403f3e3d_u32, "word u32 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u32_le_arr() { let word = test_array_64().word_u32_le(60).unwrap(); assert!(word == 0x403f3e3d_u32, "word u32 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u32_none() { let is_none = test_byte_array_64().word_u32(61).is_none(); assert!(is_none, "word u32 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u32_none_arr() { let is_none = test_array_64().word_u32(61).is_none(); assert!(is_none, "word u32 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u32_le_none() { let is_none = test_byte_array_64().word_u32_le(61).is_none(); assert!(is_none, "word u32 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u32_le_none_arr() { let is_none = test_array_64().word_u32_le(61).is_none(); assert!(is_none, "word u32 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u64() { let word = test_byte_array_64().word_u64(56).unwrap(); assert!(word == 0x393a3b3c3d3e3f40_u64, "word u64 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u64_arr() { let word = test_array_64().word_u64(56).unwrap(); assert!(word == 0x393a3b3c3d3e3f40_u64, "word u64 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u64_le() { let word = test_byte_array_64().word_u64_le(56).unwrap(); assert!(word == 0x403f3e3d3c3b3a39_u64, "word u64 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u64_le_arr() { let word = test_array_64().word_u64_le(56).unwrap(); assert!(word == 0x403f3e3d3c3b3a39_u64, "word u64 differs"); } #[test] -#[available_gas(1000000)] fn test_word_u64_none() { let is_none = test_byte_array_64().word_u64(57).is_none(); assert!(is_none, "word u64 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u64_none_arr() { let is_none = test_array_64().word_u64(57).is_none(); assert!(is_none, "word u64 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u64_le_none() { let is_none = test_byte_array_64().word_u64_le(57).is_none(); assert!(is_none, "word u64 should be empty"); } #[test] -#[available_gas(1000000)] fn test_word_u64_le_none_arr() { let is_none = test_array_64().word_u64_le(57).is_none(); assert!(is_none, "word u64 should be empty"); } #[test] -#[available_gas(2000000)] fn test_word_u128() { let word = test_byte_array_64().word_u128(48).unwrap(); assert!(word == 0x3132333435363738393a3b3c3d3e3f40_u128, "word u128 differs"); } #[test] -#[available_gas(2000000)] fn test_word_u128_arr() { let word = test_array_64().word_u128(48).unwrap(); assert!(word == 0x3132333435363738393a3b3c3d3e3f40_u128, "word u128 differs"); } #[test] -#[available_gas(2000000)] fn test_word_u128_le() { let word = test_byte_array_64().word_u128_le(48).unwrap(); assert!(word == 0x403f3e3d3c3b3a393837363534333231_u128, "word u128 differs"); } #[test] -#[available_gas(2000000)] fn test_word_u128_le_arr() { let word = test_array_64().word_u128_le(48).unwrap(); assert!(word == 0x403f3e3d3c3b3a393837363534333231_u128, "word u128 differs"); } #[test] -#[available_gas(2000000)] fn test_word_u128_none() { let is_none = test_byte_array_64().word_u128(49).is_none(); assert!(is_none, "word u128 should be empty"); @@ -210,21 +181,18 @@ fn test_word_u128_none_arr() { } #[test] -#[available_gas(2000000)] fn test_word_u128_le_none() { let is_none = test_byte_array_64().word_u128_le(49).is_none(); assert!(is_none, "word u128 should be empty"); } #[test] -#[available_gas(2000000)] fn test_word_u128_le_none_arr() { let is_none = test_array_64().word_u128_le(49).is_none(); assert!(is_none, "word u128 should be empty"); } #[test] -#[available_gas(2000000)] fn test_reader_helper() { let ba = test_byte_array_64(); let reader = ba.reader(); @@ -232,7 +200,6 @@ fn test_reader_helper() { } #[test] -#[available_gas(2000000)] fn test_reader_helper_arr() { let ba = test_array_64(); let reader = ba.reader(); @@ -240,7 +207,6 @@ fn test_reader_helper_arr() { } #[test] -#[available_gas(20000000)] fn test_len() { let ba = test_byte_array_64(); let mut rd = ba.reader(); @@ -262,7 +228,6 @@ fn test_len() { } #[test] -#[available_gas(20000000)] fn test_len_arr() { let ba = test_array_64(); let mut rd = ba.reader(); @@ -284,7 +249,6 @@ fn test_len_arr() { } #[test] -#[available_gas(20000000)] fn test_read_u256() { let ba = test_byte_array_64(); let mut rd = ba.reader(); @@ -294,7 +258,6 @@ fn test_read_u256() { } #[test] -#[available_gas(20000000)] fn test_read_u256_arr() { let ba = test_array_64(); let mut rd = ba.reader(); @@ -304,7 +267,6 @@ fn test_read_u256_arr() { } #[test] -#[available_gas(20000000)] fn test_read_u256_le() { let ba = test_byte_array_64(); let mut rd = ba.reader(); @@ -314,7 +276,6 @@ fn test_read_u256_le() { } #[test] -#[available_gas(20000000)] fn test_read_u256_le_arr() { let ba = test_array_64(); let mut rd = ba.reader(); @@ -324,7 +285,6 @@ fn test_read_u256_le_arr() { } #[test] -#[available_gas(20000000)] fn test_read_u512() { let ba = test_byte_array_64(); let mut rd = ba.reader(); @@ -337,7 +297,6 @@ fn test_read_u512() { } #[test] -#[available_gas(20000000)] fn test_read_u512_arr() { let ba = test_array_64(); let mut rd = ba.reader(); @@ -350,7 +309,6 @@ fn test_read_u512_arr() { } #[test] -#[available_gas(20000000)] fn test_read_u512_le() { let ba = test_byte_array_64(); let mut rd = ba.reader(); @@ -362,7 +320,6 @@ fn test_read_u512_le() { } #[test] -#[available_gas(20000000)] fn test_read_u512_le_arr() { let ba = test_array_64(); let mut rd = ba.reader(); @@ -374,7 +331,6 @@ fn test_read_u512_le_arr() { } #[test] -#[available_gas(20000000)] fn test_read_sequence() { let ba = test_byte_array_64(); let mut rd = ba.reader(); @@ -390,7 +346,6 @@ fn test_read_sequence() { } #[test] -#[available_gas(20000000)] fn test_read_sequence_arr() { let ba = test_array_64(); let mut rd = ba.reader(); @@ -406,7 +361,6 @@ fn test_read_sequence_arr() { } #[test] -#[available_gas(20000000)] fn test_read_sequence_le() { let ba = test_byte_array_64(); let mut rd = ba.reader(); @@ -422,7 +376,6 @@ fn test_read_sequence_le() { } #[test] -#[available_gas(20000000)] fn test_read_sequence_le_arr() { let ba = test_array_64(); let mut rd = ba.reader(); @@ -438,7 +391,6 @@ fn test_read_sequence_le_arr() { } #[test] -#[available_gas(10000000)] fn test_clone_byte_array_reader() { let ba = test_byte_array_64(); let mut rd1 = ba.reader(); @@ -451,7 +403,6 @@ fn test_clone_byte_array_reader() { } #[test] -#[available_gas(10000000)] fn test_clone_array_of_bytes_reader() { let ba = test_array_64(); let mut rd1 = ba.reader(); @@ -464,7 +415,6 @@ fn test_clone_array_of_bytes_reader() { } #[test] -#[available_gas(10000000)] fn test_byte_array_reader_equals_array_of_bytes_reader() { let mut ba = test_array_64().reader(); let mut bb = test_byte_array_64().reader(); diff --git a/packages/data_structures/src/tests/queue.cairo b/packages/data_structures/src/tests/queue.cairo index 2387e7e5..98f0c025 100644 --- a/packages/data_structures/src/tests/queue.cairo +++ b/packages/data_structures/src/tests/queue.cairo @@ -1,7 +1,6 @@ use alexandria_data_structures::queue::{Queue, QueueTrait}; #[test] -#[available_gas(2000000)] fn queue_new_test() { let queue = QueueTrait::::new(); let result_len = queue.len(); @@ -10,7 +9,6 @@ fn queue_new_test() { } #[test] -#[available_gas(2000000)] fn queue_is_empty_test() { let queue = QueueTrait::::new(); let result = queue.is_empty(); @@ -19,7 +17,6 @@ fn queue_is_empty_test() { } #[test] -#[available_gas(2000000)] fn queue_enqueue_test() { let mut queue = QueueTrait::new(); queue.enqueue(1); @@ -30,7 +27,6 @@ fn queue_enqueue_test() { } #[test] -#[available_gas(2000000)] fn queue_peek_front_test() { let mut queue = QueueTrait::new(); queue.enqueue(1); @@ -47,7 +43,6 @@ fn queue_peek_front_test() { } #[test] -#[available_gas(2000000)] fn queue_dequeue_test() { let mut queue = QueueTrait::new(); queue.enqueue(1); diff --git a/packages/data_structures/src/tests/stack.cairo b/packages/data_structures/src/tests/stack.cairo index fefcf71c..83f029b8 100644 --- a/packages/data_structures/src/tests/stack.cairo +++ b/packages/data_structures/src/tests/stack.cairo @@ -63,19 +63,16 @@ fn stack_push_pop_push_test< } #[test] -#[available_gas(2000000)] fn felt252_stack_new_test() { stack_new_test(@StackTrait::::new()); } #[test] -#[available_gas(2000000)] fn felt252_stack_is_empty_test() { stack_is_empty_test(@StackTrait::::new()); } #[test] -#[available_gas(2000000)] fn felt252_stack_push_test() { let mut stack = StackTrait::::new(); stack_push_test(ref stack, 1, 2); @@ -83,21 +80,18 @@ fn felt252_stack_push_test() { #[test] -#[available_gas(2000000)] fn felt252_stack_peek_test() { let mut stack = StackTrait::::new(); stack_peek_test(ref stack, 1, 2); } #[test] -#[available_gas(2000000)] fn felt252_stack_pop_test() { let mut stack = StackTrait::::new(); stack_pop_test(ref stack, 1, 2); } #[test] -#[available_gas(2000000)] fn felt252_stack_push_pop_push_test() { let mut stack = StackTrait::::new(); @@ -106,19 +100,16 @@ fn felt252_stack_push_pop_push_test() { #[test] -#[available_gas(2000000)] fn nullable_stack_new_test() { stack_new_test(@StackTrait::::new()); } #[test] -#[available_gas(2000000)] fn nullable_stack_is_empty_test() { stack_is_empty_test(@StackTrait::::new()); } #[test] -#[available_gas(2000000)] fn nullable_stack_push_test() { let mut stack = StackTrait::::new(); stack_push_test(ref stack, 1, 2); @@ -126,21 +117,18 @@ fn nullable_stack_push_test() { #[test] -#[available_gas(2000000)] fn nullable_stack_peek_test() { let mut stack = StackTrait::::new(); stack_peek_test(ref stack, 1, 2); } #[test] -#[available_gas(2000000)] fn nullable_stack_pop_test() { let mut stack = StackTrait::::new(); stack_pop_test(ref stack, 1, 2); } #[test] -#[available_gas(2000000)] fn nullable_stack_push_pop_push_test() { let mut stack = StackTrait::, u256>::new(); diff --git a/packages/data_structures/src/tests/vec.cairo b/packages/data_structures/src/tests/vec.cairo index a57b1258..b1fefc04 100644 --- a/packages/data_structures/src/tests/vec.cairo +++ b/packages/data_structures/src/tests/vec.cairo @@ -100,144 +100,124 @@ fn vec_index_trait_out_of_bounds_test< #[test] -#[available_gas(2000000)] fn felt252_vec_new_test() { vec_new_test(@VecTrait::::new()); } #[test] -#[available_gas(2000000)] fn felt252_vec_len_test() { let mut vec = VecTrait::::new(); vec_len_test(ref vec, 1); } #[test] -#[available_gas(2000000)] fn felt252_vec_get_test() { let mut vec = VecTrait::::new(); vec_get_test(ref vec, 1); } #[test] -#[available_gas(2000000)] fn felt252_vec_at_test() { let mut vec = VecTrait::::new(); vec_at_test(ref vec, 1); } #[test] -#[available_gas(2000000)] -#[should_panic(expected: ('Index out of bounds',))] +#[should_panic(expected: 'Index out of bounds')] fn felt252_vec_at_out_of_bounds_test() { let mut vec = VecTrait::::new(); vec_at_out_of_bounds_test(ref vec); } #[test] -#[available_gas(2000000)] fn felt252_vec_push_test() { let mut vec = VecTrait::::new(); vec_push_test(ref vec, 1); } #[test] -#[available_gas(2000000)] fn felt252_vec_set_test() { let mut vec = VecTrait::::new(); vec_set_test(ref vec, 1, 2); } #[test] -#[available_gas(2000000)] -#[should_panic(expected: ('Index out of bounds',))] +#[should_panic(expected: 'Index out of bounds')] fn felt252_vec_set_test_expect_error() { let mut vec = VecTrait::::new(); vec_set_test_expect_error(ref vec, 1, 2); } #[test] -#[available_gas(2000000)] fn felt252_vec_index_trait_test() { let mut vec = VecTrait::::new(); vec_index_trait_test(ref vec, 1, 2); } #[test] -#[available_gas(2000000)] -#[should_panic(expected: ('Index out of bounds',))] +#[should_panic(expected: 'Index out of bounds')] fn felt252_vec_index_trait_out_of_bounds_test() { let mut vec = VecTrait::::new(); vec_index_trait_out_of_bounds_test(ref vec, 1); } #[test] -#[available_gas(2000000)] fn nullable_vec_new_test() { vec_new_test(@VecTrait::::new()); } #[test] -#[available_gas(2000000)] fn nullable_vec_len_test() { let mut vec = VecTrait::::new(); vec_len_test(ref vec, 1); } #[test] -#[available_gas(2000000)] fn nullable_vec_get_test() { let mut vec = VecTrait::::new(); vec_get_test(ref vec, 1); } #[test] -#[available_gas(2000000)] fn nullable_vec_at_test() { let mut vec = VecTrait::::new(); vec_at_test(ref vec, 1); } #[test] -#[available_gas(2000000)] -#[should_panic(expected: ('Index out of bounds',))] +#[should_panic(expected: 'Index out of bounds')] fn nullable_vec_at_out_of_bounds_test() { let mut vec = VecTrait::::new(); vec_at_out_of_bounds_test(ref vec); } #[test] -#[available_gas(2000000)] fn nullable_vec_push_test() { let mut vec = VecTrait::::new(); vec_push_test(ref vec, 1); } #[test] -#[available_gas(2000000)] fn nullable_vec_set_test() { let mut vec = VecTrait::::new(); vec_set_test(ref vec, 1, 2); } #[test] -#[available_gas(2000000)] -#[should_panic(expected: ('Index out of bounds',))] +#[should_panic(expected: 'Index out of bounds')] fn nullable_vec_set_test_expect_error() { let mut vec = VecTrait::::new(); vec_set_test_expect_error(ref vec, 1, 2); } #[test] -#[available_gas(2000000)] fn nullable_vec_index_trait_test() { let mut vec = VecTrait::::new(); vec_index_trait_test(ref vec, 1, 2); } #[test] -#[available_gas(2000000)] -#[should_panic(expected: ('Index out of bounds',))] +#[should_panic(expected: 'Index out of bounds')] fn nullable_vec_index_trait_out_of_bounds_test() { let mut vec = VecTrait::::new(); vec_index_trait_out_of_bounds_test(ref vec, 1); diff --git a/packages/encoding/Scarb.toml b/packages/encoding/Scarb.toml index 82c57476..e8399607 100644 --- a/packages/encoding/Scarb.toml +++ b/packages/encoding/Scarb.toml @@ -14,4 +14,9 @@ alexandria_numeric = { path = "../numeric" } alexandria_bytes = { path = "../bytes" } [dev-dependencies] -cairo_test.workspace = true \ No newline at end of file +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/encoding/src/tests/base64_felt_test.cairo b/packages/encoding/src/tests/base64_felt_test.cairo index 9d64a92a..807e9f34 100644 --- a/packages/encoding/src/tests/base64_felt_test.cairo +++ b/packages/encoding/src/tests/base64_felt_test.cairo @@ -21,7 +21,6 @@ fn bytes_be(val: felt252) -> Array { } #[test] -#[available_gas(2000000000)] fn base64encode_empty_test() { let input = 0; let result = Base64FeltEncoder::encode(input); @@ -30,7 +29,6 @@ fn base64encode_empty_test() { } #[test] -#[available_gas(2000000000)] fn base64encode_simple_test() { let input = 'a'; let result = Base64FeltEncoder::encode(input); @@ -39,7 +37,6 @@ fn base64encode_simple_test() { } #[test] -#[available_gas(2000000000)] fn base64encode_hello_world_test() { let input = 'hello world'; let result = Base64FeltEncoder::encode(input); @@ -49,7 +46,6 @@ fn base64encode_hello_world_test() { #[test] -#[available_gas(2000000000)] fn base64encode_with_plus_and_slash() { let mut input = 65519; // Equivalent to array![255, 239] as bytes_be @@ -59,7 +55,6 @@ fn base64encode_with_plus_and_slash() { } #[test] -#[available_gas(2000000000)] fn base64urlencode_with_plus_and_slash() { let mut input = 65519; // Equivalent to array![255, 239] as bytes_be diff --git a/packages/encoding/src/tests/base64_test.cairo b/packages/encoding/src/tests/base64_test.cairo index 34e16f75..0f455f9c 100644 --- a/packages/encoding/src/tests/base64_test.cairo +++ b/packages/encoding/src/tests/base64_test.cairo @@ -1,7 +1,6 @@ use alexandria_encoding::base64::{Base64Encoder, Base64Decoder, Base64UrlEncoder, Base64UrlDecoder}; #[test] -#[available_gas(2000000000)] fn base64encode_empty_test() { let input = array![]; let result = Base64Encoder::encode(input); @@ -9,7 +8,6 @@ fn base64encode_empty_test() { } #[test] -#[available_gas(2000000000)] fn base64encode_simple_test() { let input = array!['a']; @@ -22,7 +20,6 @@ fn base64encode_simple_test() { } #[test] -#[available_gas(2000000000)] fn base64encode_hello_world_test() { let input = array!['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']; @@ -47,7 +44,6 @@ fn base64encode_hello_world_test() { } #[test] -#[available_gas(2000000000)] fn base64decode_empty_test() { let input = array![]; @@ -56,7 +52,6 @@ fn base64decode_empty_test() { } #[test] -#[available_gas(2000000000)] fn base64decode_simple_test() { let input = array!['Y', 'Q', '=', '=']; @@ -66,7 +61,6 @@ fn base64decode_simple_test() { } #[test] -#[available_gas(2000000000)] fn base64decode_hello_world_test() { let input = array![ 'a', 'G', 'V', 's', 'b', 'G', '8', 'g', 'd', '2', '9', 'y', 'b', 'G', 'Q', '=' @@ -88,7 +82,6 @@ fn base64decode_hello_world_test() { } #[test] -#[available_gas(2000000000)] fn base64encode_with_plus_and_slash() { let input = array![255, 239]; @@ -101,7 +94,6 @@ fn base64encode_with_plus_and_slash() { } #[test] -#[available_gas(2000000000)] fn base64urlencode_with_plus_and_slash() { let input = array![255, 239]; @@ -114,7 +106,6 @@ fn base64urlencode_with_plus_and_slash() { } #[test] -#[available_gas(2000000000)] fn base64decode_with_plus_and_slash() { let input = array!['/', '+', '8', '=']; @@ -125,7 +116,6 @@ fn base64decode_with_plus_and_slash() { } #[test] -#[available_gas(2000000000)] fn base64urldecode_with_plus_and_slash() { let input = array!['_', '-', '8', '=']; diff --git a/packages/encoding/src/tests/reversible_test.cairo b/packages/encoding/src/tests/reversible_test.cairo index 0618b4c7..099d72ec 100644 --- a/packages/encoding/src/tests/reversible_test.cairo +++ b/packages/encoding/src/tests/reversible_test.cairo @@ -2,7 +2,6 @@ use alexandria_encoding::reversible::{ReversibleBits, ReversibleBytes}; use core::integer::u512; #[test] -#[available_gas(1000000)] fn test_reverse_bytes_u8() { let t: u8 = 0b10111010; let rev = t.reverse_bytes(); @@ -11,7 +10,6 @@ fn test_reverse_bytes_u8() { } #[test] -#[available_gas(1000000)] fn test_reverse_bytes_u16() { let t: u16 = 0x1122; let rev = t.reverse_bytes(); @@ -20,7 +18,6 @@ fn test_reverse_bytes_u16() { } #[test] -#[available_gas(1000000)] fn test_reverse_bytes_u32() { let t: u32 = 0x11223344; let rev = t.reverse_bytes(); @@ -29,7 +26,6 @@ fn test_reverse_bytes_u32() { } #[test] -#[available_gas(1000000)] fn test_reverse_bytes_u64() { let t: u64 = 0x1122334455667788; let rev = t.reverse_bytes(); @@ -38,7 +34,6 @@ fn test_reverse_bytes_u64() { } #[test] -#[available_gas(1000000)] fn test_reverse_bytes_u128() { let t: u128 = 0x112233445566778899aabbccddeeff00; let rev = t.reverse_bytes(); @@ -47,7 +42,6 @@ fn test_reverse_bytes_u128() { } #[test] -#[available_gas(10000000)] fn test_reverse_bytes_u256() { let t1: u128 = 0x101112131415161718191a1b1c1d1e1f; let t2: u128 = 0x202122232425262728292a2b2c2d2e2f; @@ -58,7 +52,6 @@ fn test_reverse_bytes_u256() { } #[test] -#[available_gas(10000000)] fn test_reverse_bytes_u512() { let t0: u128 = 0x101112131415161718191a1b1c1d1e1f; let t1: u128 = 0x202122232425262728292a2b2c2d2e2f; @@ -77,7 +70,6 @@ fn test_reverse_bytes_u512() { } #[test] -#[available_gas(10000000)] fn test_reverse_bytes_bytes31() { let t1: u128 = 0x101112131415161718191a1b1c1d1e1f; let t2: u128 = 0x202122232425262728292a2b2c2d2e; @@ -94,7 +86,6 @@ fn test_reverse_bytes_bytes31() { } #[test] -#[available_gas(10000000)] fn test_reverse_bytes_array() { let t: Array = array![0x1122, 0x3344, 0x5566, 0x7788, 0x99aa, 0xbbcc, 0xddee]; let t_rev: Array = array![0xeedd, 0xccbb, 0xaa99, 0x8877, 0x6655, 0x4433, 0x2211]; @@ -104,7 +95,6 @@ fn test_reverse_bytes_array() { } #[test] -#[available_gas(1000000)] fn test_reverse_bits_u8() { let t: u8 = 0b10111010; let t_rev: u8 = 0b01011101; @@ -114,7 +104,6 @@ fn test_reverse_bits_u8() { } #[test] -#[available_gas(1000000)] fn test_reverse_bits_u16() { let t: u16 = 0x11aa; let t_rev: u16 = 0x5588; @@ -124,7 +113,6 @@ fn test_reverse_bits_u16() { } #[test] -#[available_gas(10000000)] fn test_reverse_bits_u32() { let t: u32 = 0x1111aaaa; let t_rev: u32 = 0x55558888; @@ -134,7 +122,6 @@ fn test_reverse_bits_u32() { } #[test] -#[available_gas(10000000)] fn test_reverse_bits_u64() { let t: u64 = 0x11111111aaaaaaaa; let t_rev: u64 = 0x5555555588888888; @@ -144,7 +131,6 @@ fn test_reverse_bits_u64() { } #[test] -#[available_gas(10000000)] fn test_reverse_bits_u128() { let t: u128 = 0x1111111111111111aaaaaaaaaaaaaaaa; let t_rev: u128 = 0x55555555555555558888888888888888; @@ -154,7 +140,6 @@ fn test_reverse_bits_u128() { } #[test] -#[available_gas(100000000)] fn test_reverse_bits_u256() { let t1: u128 = 0x1111111111111111aaaaaaaaaaaaaaaa; let t2: u128 = 0xcccccccccccccccc7777777777777777; @@ -168,7 +153,6 @@ fn test_reverse_bits_u256() { } #[test] -#[available_gas(100000000)] fn test_reverse_bits_u512() { let t0: u128 = 0x1111111111111111aaaaaaaaaaaaaaaa; let t1: u128 = 0xcccccccccccccccc7777777777777777; @@ -187,7 +171,6 @@ fn test_reverse_bits_u512() { } #[test] -#[available_gas(100000000)] fn test_reverse_bits_bytes31() { let t1: u128 = 0x123457bcde123457bcde123457bcde12; let t2: u128 = 0x84c2aed3b784c2aed3b784c2aed3b7; @@ -205,7 +188,6 @@ fn test_reverse_bits_bytes31() { } #[test] -#[available_gas(100000000)] fn test_reverse_bits_array() { let t: Array = array![0x1234, 0x57bc, 0xde84, 0xc2ae, 0xd3b7]; let t_rev: Array = array![0xedcb, 0x7543, 0x217b, 0x3dea, 0x2c48]; diff --git a/packages/encoding/src/tests/rlp_test.cairo b/packages/encoding/src/tests/rlp_test.cairo index ab15cb66..55af428c 100644 --- a/packages/encoding/src/tests/rlp_test.cairo +++ b/packages/encoding/src/tests/rlp_test.cairo @@ -1,7 +1,6 @@ use alexandria_encoding::rlp::{RLPError, RLPType, RLPTrait, RLPItem}; #[test] -#[available_gas(99999999)] fn test_rlp_decode_type_byte() { let arr = array![0x78]; @@ -13,7 +12,6 @@ fn test_rlp_decode_type_byte() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_type_short_string() { let arr = array![0x82]; @@ -25,7 +23,6 @@ fn test_rlp_decode_type_short_string() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_type_long_string() { let arr = array![0xb9, 0x01, 0x02]; @@ -37,7 +34,6 @@ fn test_rlp_decode_type_long_string() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_type_short_list() { let arr = array![0xc3]; @@ -49,7 +45,6 @@ fn test_rlp_decode_type_short_list() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_type_long_list() { let arr = array![0xf9, 0x01, 0x02]; @@ -61,7 +56,6 @@ fn test_rlp_decode_type_long_list() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_type_long_list_len_too_short() { let arr = array![0xf9, 0x01]; @@ -72,7 +66,6 @@ fn test_rlp_decode_type_long_list_len_too_short() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_type_long_string_payload_too_long() { let arr = array![0xbf, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02]; @@ -83,7 +76,6 @@ fn test_rlp_decode_type_long_string_payload_too_long() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_type_long_list_payload_too_long() { let arr = array![0xfc, 0x01, 0x02, 0x02, 0x02, 0x02]; @@ -94,7 +86,6 @@ fn test_rlp_decode_type_long_list_payload_too_long() { } #[test] -#[available_gas(9999999)] fn test_rlp_empty() { let res = RLPTrait::decode(ArrayTrait::new().span()); @@ -103,7 +94,6 @@ fn test_rlp_empty() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_string_default_value() { let arr = array![0x80]; @@ -116,7 +106,6 @@ fn test_rlp_decode_string_default_value() { #[test] -#[available_gas(99999999)] fn test_rlp_decode_string() { let mut i = 0; while (i != 128) { @@ -131,7 +120,6 @@ fn test_rlp_decode_string() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_short_string() { let mut arr = array![ 0x9b, @@ -175,7 +163,6 @@ fn test_rlp_decode_short_string() { #[test] -#[available_gas(99999999)] fn test_rlp_decode_short_string_input_too_short() { let arr = array![ 0x9b, @@ -214,7 +201,6 @@ fn test_rlp_decode_short_string_input_too_short() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_long_string_with_payload_len_on_1_byte() { let mut arr = array![ 0xb8, @@ -292,7 +278,6 @@ fn test_rlp_decode_long_string_with_payload_len_on_1_byte() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_long_string_with_input_too_short() { let arr = array![ 0xb8, @@ -365,7 +350,6 @@ fn test_rlp_decode_long_string_with_input_too_short() { #[test] -#[available_gas(99999999)] fn test_rlp_decode_long_string_with_payload_len_on_2_bytes() { let mut arr = array![ 0xb9, @@ -643,7 +627,6 @@ fn test_rlp_decode_long_string_with_payload_len_on_2_bytes() { } #[test] -#[available_gas(99999999)] fn test_rlp_decode_long_string_with_payload_len_too_short() { let arr = array![0xb9, 0x01,]; @@ -654,7 +637,6 @@ fn test_rlp_decode_long_string_with_payload_len_too_short() { } #[test] -#[available_gas(99999999999)] fn test_rlp_decode_short_list() { let arr = array![0xc9, 0x83, 0x35, 0x35, 0x35, 0x42, 0x83, 0x45, 0x38, 0x92]; let res = RLPTrait::decode(arr.span()).unwrap(); @@ -669,7 +651,6 @@ fn test_rlp_decode_short_list() { } #[test] -#[available_gas(99999999999)] fn test_rlp_decode_short_nested_list() { let arr = array![0xc7, 0xc0, 0xc1, 0xc0, 0xc3, 0xc0, 0xc1, 0xc0]; let res = RLPTrait::decode(arr.span()).unwrap(); @@ -684,7 +665,6 @@ fn test_rlp_decode_short_nested_list() { } #[test] -#[available_gas(99999999999)] fn test_rlp_decode_multi_list() { let mut arr = array![0xc6, 0x82, 0x7a, 0x77, 0xc1, 0x04, 0x01,]; @@ -700,7 +680,6 @@ fn test_rlp_decode_multi_list() { } #[test] -#[available_gas(99999999999)] fn test_rlp_decode_short_list_with_input_too_short() { let arr = array![0xc9, 0x83, 0x35, 0x35, 0x89, 0x42, 0x83, 0x45, 0x38]; @@ -711,7 +690,6 @@ fn test_rlp_decode_short_list_with_input_too_short() { } #[test] -#[available_gas(99999999999)] fn test_rlp_decode_long_list() { let mut arr = array![ 0xf9, @@ -1871,7 +1849,6 @@ fn test_rlp_decode_long_list() { #[test] -#[available_gas(99999999999)] fn test_rlp_decode_long_list_with_input_too_short() { let mut arr = array![ 0xf9, @@ -1911,7 +1888,6 @@ fn test_rlp_decode_long_list_with_input_too_short() { } #[test] -#[available_gas(99999999999)] fn test_rlp_decode_long_list_with_len_too_short() { let arr = array![0xf9, 0x02,]; @@ -1922,7 +1898,6 @@ fn test_rlp_decode_long_list_with_len_too_short() { } #[test] -#[available_gas(20000000)] fn test_rlp_encode_empty_input_should_fail() { let input = array![]; @@ -1934,7 +1909,6 @@ fn test_rlp_encode_empty_input_should_fail() { #[test] -#[available_gas(20000000)] fn test_rlp_encode_default_value() { let input = RLPItem::String(array![].span()); @@ -1945,7 +1919,6 @@ fn test_rlp_encode_default_value() { } #[test] -#[available_gas(20000000)] fn test_rlp_encode_string_single_byte_lt_0x80() { let mut input: Array = Default::default(); input.append(0x40); @@ -1957,7 +1930,6 @@ fn test_rlp_encode_string_single_byte_lt_0x80() { } #[test] -#[available_gas(20000000)] fn test_rlp_encode_string_single_byte_ge_0x80() { let mut input: Array = Default::default(); input.append(0x80); @@ -1970,7 +1942,6 @@ fn test_rlp_encode_string_single_byte_ge_0x80() { } #[test] -#[available_gas(20000000)] fn test_rlp_encode_string_length_between_2_and_55() { let mut input: Array = Default::default(); input.append(0x40); @@ -1985,7 +1956,6 @@ fn test_rlp_encode_string_length_between_2_and_55() { } #[test] -#[available_gas(20000000)] fn test_rlp_encode_string_length_exactly_56() { let mut input: Array = Default::default(); let mut i = 0; @@ -2011,7 +1981,6 @@ fn test_rlp_encode_string_length_exactly_56() { #[test] -#[available_gas(20000000)] fn test_rlp_encode_string_length_greater_than_56() { let mut input: Array = Default::default(); let mut i = 0; @@ -2033,7 +2002,6 @@ fn test_rlp_encode_string_length_greater_than_56() { } #[test] -#[available_gas(200000000)] fn test_rlp_encode_string_large_bytearray_inputs() { let mut input: Array = Default::default(); let mut i = 0; @@ -2056,7 +2024,6 @@ fn test_rlp_encode_string_large_bytearray_inputs() { } #[test] -#[available_gas(20000000)] fn test_rlp_encode_mutilple_string() { let mut input = array![]; input.append(RLPItem::String(array![0x40, 0x53, 0x15, 0x94, 0x50, 0x40, 0x40, 0x40].span())); @@ -2071,7 +2038,6 @@ fn test_rlp_encode_mutilple_string() { } #[test] -#[available_gas(99999999999)] fn test_rlp_encode_short_list() { let string_0 = RLPItem::String(array![0x35, 0x35, 0x35].span()); let string_1 = RLPItem::String(array![0x42].span()); @@ -2087,7 +2053,6 @@ fn test_rlp_encode_short_list() { } #[test] -#[available_gas(99999999999)] fn test_rlp_encode_short_nested_list() { let string_0 = RLPItem::List(array![].span()); let string_1 = RLPItem::List(array![string_0].span()); @@ -2103,7 +2068,6 @@ fn test_rlp_encode_short_nested_list() { } #[test] -#[available_gas(99999999999)] fn test_rlp_encode_long_list() { let string_0 = RLPItem::String( array![ diff --git a/packages/linalg/Scarb.toml b/packages/linalg/Scarb.toml index 24697711..9bef5174 100644 --- a/packages/linalg/Scarb.toml +++ b/packages/linalg/Scarb.toml @@ -12,4 +12,9 @@ fmt.workspace = true alexandria_math = { path = "../math" } [dev-dependencies] -cairo_test.workspace = true \ No newline at end of file +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/linalg/src/tests/dot_test.cairo b/packages/linalg/src/tests/dot_test.cairo index fff011d8..f6ed3650 100644 --- a/packages/linalg/src/tests/dot_test.cairo +++ b/packages/linalg/src/tests/dot_test.cairo @@ -1,7 +1,6 @@ use alexandria_linalg::dot::dot; #[test] -#[available_gas(2000000)] fn dot_product_test() { let xs = array![3_u64, 5, 7]; let ys = array![11, 13, 17]; @@ -9,7 +8,7 @@ fn dot_product_test() { } #[test] -#[should_panic(expected: ('Arrays must have the same len',))] +#[should_panic(expected: 'Arrays must have the same len')] #[available_gas(2000000)] fn dot_product_test_check_len() { let xs = array![1_u64]; diff --git a/packages/linalg/src/tests/kron_test.cairo b/packages/linalg/src/tests/kron_test.cairo index 26be4b66..bc8e717a 100644 --- a/packages/linalg/src/tests/kron_test.cairo +++ b/packages/linalg/src/tests/kron_test.cairo @@ -1,7 +1,6 @@ use alexandria_linalg::kron::{kron, KronError}; #[test] -#[available_gas(2000000)] fn kron_product_test() { let xs = array![1_u64, 10, 100]; let ys = array![5, 6, 7]; @@ -18,7 +17,6 @@ fn kron_product_test() { } #[test] -#[available_gas(2000000)] fn kron_product_test_check_len() { let xs = array![1_u64]; let ys = array![]; diff --git a/packages/linalg/src/tests/norm_test.cairo b/packages/linalg/src/tests/norm_test.cairo index d432bbf0..9fae377d 100644 --- a/packages/linalg/src/tests/norm_test.cairo +++ b/packages/linalg/src/tests/norm_test.cairo @@ -1,28 +1,24 @@ use alexandria_linalg::norm::norm; #[test] -#[available_gas(2000000)] fn norm_test_1() { let array = array![3_u128, 4]; assert_eq!(norm(array.span(), 2, 10), 5); } #[test] -#[available_gas(2000000)] fn norm_test_2() { let array = array![3_u128, 4]; assert_eq!(norm(array.span(), 1, 10), 7); } #[test] -#[available_gas(2000000)] fn norm_test_3() { let array = array![3_u128, 4]; assert_eq!(norm(array.span(), 0, 10), 2); } #[test] -#[available_gas(2000000)] fn norm_test_into() { let array = array![3_u32, 4]; assert_eq!(norm(array.span(), 2, 10), 5); diff --git a/packages/macros/Scarb.toml b/packages/macros/Scarb.toml index 528a58fc..397adcc9 100644 --- a/packages/macros/Scarb.toml +++ b/packages/macros/Scarb.toml @@ -11,4 +11,9 @@ edition = "2024_07" fmt.workspace = true [dev-dependencies] -cairo_test.workspace = true +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/math/Scarb.toml b/packages/math/Scarb.toml index b05035f6..ce3856dc 100644 --- a/packages/math/Scarb.toml +++ b/packages/math/Scarb.toml @@ -9,4 +9,9 @@ edition = "2023_11" fmt.workspace = true [dev-dependencies] -cairo_test.workspace = true +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/math/src/tests/aliquot_sum_test.cairo b/packages/math/src/tests/aliquot_sum_test.cairo index 608debf2..c8368e12 100644 --- a/packages/math/src/tests/aliquot_sum_test.cairo +++ b/packages/math/src/tests/aliquot_sum_test.cairo @@ -1,43 +1,36 @@ use alexandria_math::aliquot_sum::aliquot_sum; #[test] -#[available_gas(200000)] fn zero_test() { assert_eq!(aliquot_sum(0), 0); } #[test] -#[available_gas(200000)] fn one_test() { assert_eq!(aliquot_sum(1), 0); } #[test] -#[available_gas(200000)] fn two_test() { assert_eq!(aliquot_sum(2), 1); } #[test] -#[available_gas(200000)] fn one_digit_number_test() { assert_eq!(aliquot_sum(6), 6); } #[test] -#[available_gas(2000000)] fn two_digit_number_test() { assert_eq!(aliquot_sum(15), 9); } #[test] -#[available_gas(20000000)] fn three_digit_number_test() { assert_eq!(aliquot_sum(343), 57); } #[test] -#[available_gas(2000000)] fn two_digit_prime_number_test() { assert_eq!(aliquot_sum(17), 1); } diff --git a/packages/math/src/tests/armstrong_number_test.cairo b/packages/math/src/tests/armstrong_number_test.cairo index d40e6c7f..8e03e5ea 100644 --- a/packages/math/src/tests/armstrong_number_test.cairo +++ b/packages/math/src/tests/armstrong_number_test.cairo @@ -1,25 +1,21 @@ use alexandria_math::armstrong_number::is_armstrong_number; #[test] -#[available_gas(200000)] fn one_digit_armstrong_number_test() { assert!(is_armstrong_number(1), "invalid result"); } #[test] -#[available_gas(200000)] fn two_digit_numbers_are_not_armstrong_numbers_test() { assert!(!is_armstrong_number(15), "invalid result"); } #[test] -#[available_gas(2000000)] fn three_digit_armstrong_number_test() { assert!(is_armstrong_number(153), "invalid result"); } #[test] -#[available_gas(2000000)] fn three_digit_non_armstrong_number_test() { assert!(!is_armstrong_number(105), "invalid result"); } diff --git a/packages/math/src/tests/collatz_sequence_test.cairo b/packages/math/src/tests/collatz_sequence_test.cairo index 6c39763a..c063ef26 100644 --- a/packages/math/src/tests/collatz_sequence_test.cairo +++ b/packages/math/src/tests/collatz_sequence_test.cairo @@ -1,19 +1,16 @@ use alexandria_math::collatz_sequence::sequence; #[test] -#[available_gas(2000000)] fn collatz_sequence_10_test() { assert_eq!(sequence(10).len(), 7); } #[test] -#[available_gas(2000000)] fn collatz_sequence_15_test() { assert_eq!(sequence(15).len(), 18); } #[test] -#[available_gas(2000000)] fn collatz_sequence_empty_test() { assert_eq!(sequence(0).len(), 0); } diff --git a/packages/math/src/tests/ed25519_test.cairo b/packages/math/src/tests/ed25519_test.cairo index 3cb0ff31..df36a7cc 100644 --- a/packages/math/src/tests/ed25519_test.cairo +++ b/packages/math/src/tests/ed25519_test.cairo @@ -4,7 +4,6 @@ use alexandria_math::ed25519::{verify_signature, Point, PointOperations, p_non_z // (https://github.com/paulmillr/noble-ed25519) #[test] -#[available_gas(3200000000)] fn verify_signature_test_0() { let pub_key: u256 = 0x1e6c5b385880849f46716d691b8a447d7cbe4a7ef154f3e2174ffb3c5256fcfe; @@ -18,7 +17,6 @@ fn verify_signature_test_0() { } #[test] -#[available_gas(3200000000)] fn verify_signature_test_1() { let pub_key: u256 = 0xcc05c1a7ba2937b1c0e71ca1ac636e7240c39fdc8e4672bb0c125eff082324d4; @@ -32,7 +30,6 @@ fn verify_signature_test_1() { } #[test] -#[available_gas(3200000000)] fn verify_signature_test_2() { let pub_key: u256 = 0x136fa0f7464a55d9a19e9dd0e2edf4f605d3b3f3228dbbe3d7337136ae216d49; @@ -46,7 +43,6 @@ fn verify_signature_test_2() { } #[test] -#[available_gas(3200000000)] fn verify_signature_test_3() { let pub_key: u256 = 0x040369a47bcee3ae0cb373037ec0d2e36cae4a3762e388ff0682962aef49f444; @@ -60,7 +56,6 @@ fn verify_signature_test_3() { } #[test] -#[available_gas(3200000000)] fn verify_signature_invalid() { let pub_key: u256 = 0x040369a47bcee3ae0cb373037ec0d2e36cae4a3762e388ff0682962aef49f444; @@ -74,7 +69,6 @@ fn verify_signature_invalid() { } #[test] -#[available_gas(3200000000)] fn verify_signature_invalid_length() { let pub_key: u256 = 0x040369a47bcee3ae0cb373037ec0d2e36cae4a3762e388ff0682962aef49f444; diff --git a/packages/math/src/tests/extended_euclidean_algorithm_test.cairo b/packages/math/src/tests/extended_euclidean_algorithm_test.cairo index af5b4ca6..88aa01ed 100644 --- a/packages/math/src/tests/extended_euclidean_algorithm_test.cairo +++ b/packages/math/src/tests/extended_euclidean_algorithm_test.cairo @@ -12,7 +12,6 @@ fn test_case(a: u128, b: u128, expected: (u128, u128, u128)) { } #[test] -#[available_gas(2000000)] fn extended_euclidean_algorithm_test() { test_case(101, 13, (1, 4, 0.wrapping_sub(31))); test_case(123, 19, (1, 0.wrapping_sub(2), 13)); diff --git a/packages/math/src/tests/fast_power_test.cairo b/packages/math/src/tests/fast_power_test.cairo index d6af0bfc..da926aad 100644 --- a/packages/math/src/tests/fast_power_test.cairo +++ b/packages/math/src/tests/fast_power_test.cairo @@ -1,7 +1,6 @@ use alexandria_math::fast_power::{fast_power, fast_power_mod}; #[test] -#[available_gas(1000000000)] fn fast_power_test() { assert_eq!(fast_power(2_u128, 1_u128), 2); assert_eq!(fast_power(2_u128, 2_u128), 4); @@ -20,7 +19,6 @@ fn fast_power_test() { } #[test] -#[available_gas(1000000000)] fn fast_power_mod_test() { assert_eq!(fast_power_mod(2_u128, 1_u128, 17_u128), 2); assert_eq!(fast_power_mod(2_u128, 2_u128, 17_u128), 4); diff --git a/packages/math/src/tests/fast_root_test.cairo b/packages/math/src/tests/fast_root_test.cairo index b12f8b93..0c6ffbf1 100644 --- a/packages/math/src/tests/fast_root_test.cairo +++ b/packages/math/src/tests/fast_root_test.cairo @@ -3,31 +3,26 @@ use alexandria_math::fast_root::fast_nr_optimize; use alexandria_math::fast_root::fast_sqrt; #[test] -#[available_gas(5000000)] fn fast_sqrt_test_1() { assert_eq!(fast_sqrt(100, 10), 10); } #[test] -#[available_gas(5000000)] fn fast_sqrt_test_2() { assert_eq!(fast_sqrt(79, 10), 9); } #[test] -#[available_gas(5000000)] fn fast_curt_test_1() { assert_eq!(fast_cbrt(1000, 10), 10); } #[test] -#[available_gas(5000000)] fn fast_nr_optimize_test_1() { assert_eq!(fast_nr_optimize(10000, 4, 30), 10); } #[test] -#[available_gas(5000000)] fn fast_nr_optimize_test_2() { assert_eq!(fast_nr_optimize(10, 1, 10), 10); } diff --git a/packages/math/src/tests/fibonacci_test.cairo b/packages/math/src/tests/fibonacci_test.cairo index 3ec5c1cc..48663bac 100644 --- a/packages/math/src/tests/fibonacci_test.cairo +++ b/packages/math/src/tests/fibonacci_test.cairo @@ -1,7 +1,6 @@ use alexandria_math::fibonacci::fib; #[test] -#[available_gas(200000)] fn fibonacci_test() { assert_eq!(fib(0, 1, 10), 55); assert_eq!(fib(2, 4, 8), 110); diff --git a/packages/math/src/tests/gcd_of_n_numbers_test.cairo b/packages/math/src/tests/gcd_of_n_numbers_test.cairo index 25c6d8a7..bd648bf9 100644 --- a/packages/math/src/tests/gcd_of_n_numbers_test.cairo +++ b/packages/math/src/tests/gcd_of_n_numbers_test.cairo @@ -1,21 +1,18 @@ use alexandria_math::gcd_of_n_numbers::gcd; #[test] -#[available_gas(1000000000)] fn gcd_test() { let arr = array![2, 4, 6, 8, 10]; assert_eq!(gcd(arr.span()), 2); } #[test] -#[available_gas(1000000000)] fn gcd_test_inverse() { let arr = array![10, 8, 6, 4, 2]; assert_eq!(gcd(arr.span()), 2); } #[test] -#[available_gas(1000000000)] fn gcd_test_3() { let arr = array![3, 6, 12, 99]; assert_eq!(gcd(arr.span()), 3); @@ -23,15 +20,13 @@ fn gcd_test_3() { #[test] -#[available_gas(1000000000)] fn gcd_single_test() { let arr = array![10]; assert_eq!(gcd(arr.span()), 10); } #[test] -#[available_gas(1000000000)] -#[should_panic(expected: ("gcd-empty",))] +#[should_panic(expected: "gcd-empty")] fn gcd_empty_input_test() { let mut arr = array![]; gcd(arr.span()); diff --git a/packages/math/src/tests/is_power_of_two_test.cairo b/packages/math/src/tests/is_power_of_two_test.cairo index 26f3ab2f..11615ed7 100644 --- a/packages/math/src/tests/is_power_of_two_test.cairo +++ b/packages/math/src/tests/is_power_of_two_test.cairo @@ -1,31 +1,26 @@ use alexandria_math::is_power_of_two::is_power_of_two; #[test] -#[available_gas(200000)] fn is_power_of_two_test_1() { assert!(is_power_of_two(1), "invalid result"); } #[test] -#[available_gas(200000)] fn is_power_of_two_test_2() { assert!(is_power_of_two(2), "invalid result"); } #[test] -#[available_gas(200000)] fn is_power_of_two_test_3() { assert!(!is_power_of_two(3), "invalid result"); } #[test] -#[available_gas(200000)] fn is_power_of_two_test_4() { assert!(is_power_of_two(128), "invalid result"); } #[test] -#[available_gas(200000)] fn is_power_of_two_test_5() { assert_eq!(is_power_of_two(0), false); } diff --git a/packages/math/src/tests/is_prime_test.cairo b/packages/math/src/tests/is_prime_test.cairo index 001cf0b2..e71fcd06 100644 --- a/packages/math/src/tests/is_prime_test.cairo +++ b/packages/math/src/tests/is_prime_test.cairo @@ -1,25 +1,21 @@ use alexandria_math::is_prime::is_prime; #[test] -#[available_gas(200000)] fn is_prime_test_1() { assert!(is_prime(2, 10)); } #[test] -#[available_gas(200000)] fn is_prime_test_2() { assert!(!is_prime(0, 10)); } #[test] -#[available_gas(200000)] fn is_prime_test_3() { assert!(!is_prime(1, 10)); } #[test] -#[available_gas(2000000)] fn is_prime_test_4() { assert!(is_prime(97, 10)); } diff --git a/packages/math/src/tests/karatsuba_test.cairo b/packages/math/src/tests/karatsuba_test.cairo index 1395ca1f..29b739e8 100644 --- a/packages/math/src/tests/karatsuba_test.cairo +++ b/packages/math/src/tests/karatsuba_test.cairo @@ -1,19 +1,6 @@ use alexandria_math::karatsuba::multiply; -// TODO All the out of gas have got lazily fixed. Maybe there is a way to fix those. #[test] -#[available_gas(10000000)] -#[should_panic(expected: ('Out of gas',))] -fn multiply_same_size_positive_number() { - let n1 = 31415; - let n2 = 31415; - let result = 986902225; - assert_eq!(multiply(n1, n2), result); -} - - -#[test] -#[available_gas(10000000)] fn multiply_distinct_size_positive_number() { let n1 = 10296; let n2 = 25912511; @@ -22,17 +9,6 @@ fn multiply_distinct_size_positive_number() { } #[test] -#[available_gas(20000000)] -#[should_panic(expected: ('Out of gas',))] -fn multiply_by_zero() { - let n1 = 10296; - let n2 = 0; - let result = 0; - assert_eq!(multiply(n1, n2), result); -} - -#[test] -#[available_gas(20000000)] fn multiply_by_number_lt_ten() { let n1 = 1000; let n2 = 2; diff --git a/packages/math/src/tests/lcm_of_n_numbers_test.cairo b/packages/math/src/tests/lcm_of_n_numbers_test.cairo index 265fdd77..2d7dd3fe 100644 --- a/packages/math/src/tests/lcm_of_n_numbers_test.cairo +++ b/packages/math/src/tests/lcm_of_n_numbers_test.cairo @@ -9,35 +9,30 @@ impl u128_into_u32 of Into { } #[test] -#[available_gas(1000000000)] fn lcm_test() { let arr = array![2_u128, 4, 6, 8, 10]; assert_eq!(lcm(arr.span()).unwrap(), 120); } #[test] -#[available_gas(1000000000)] fn lcm_test_tryinto() { let arr = array![2_u32, 4, 6, 8, 10]; assert_eq!(lcm(arr.span()).unwrap(), 120); } #[test] -#[available_gas(1000000000)] fn lcm_test_inverse() { let arr = array![10_u128, 8, 6, 4, 2]; assert_eq!(lcm(arr.span()).unwrap(), 120); } #[test] -#[available_gas(1000000000)] fn lcm_test_3() { let arr = array![3_u128, 6, 12, 99]; assert_eq!(lcm(arr.span()).unwrap(), 396); } #[test] -#[available_gas(1000000000)] fn lcm_test_4() { let arr = array![1_u128, 2, 8, 3]; assert_eq!(lcm(arr.span()).unwrap(), 24); @@ -45,14 +40,12 @@ fn lcm_test_4() { #[test] -#[available_gas(1000000000)] fn lcm_single_test() { let arr = array![10_u128]; assert_eq!(lcm(arr.span()).unwrap(), 10); } #[test] -#[available_gas(1000000000)] fn lcm_empty_input_test() { let arr: Array = array![]; assert!(lcm(arr.span()) == Result::Err(LCMError::EmptyInput), "Empty inputs"); diff --git a/packages/math/src/tests/math_test.cairo b/packages/math/src/tests/math_test.cairo index f7a767f3..0b68ff88 100644 --- a/packages/math/src/tests/math_test.cairo +++ b/packages/math/src/tests/math_test.cairo @@ -3,7 +3,6 @@ use core::num::traits::Bounded; // Test power function #[test] -#[available_gas(1000000000)] fn test_pow_power_2_all() { assert_eq!(pow::(2, 0), 1); assert_eq!(pow::(2, 1), 2); @@ -137,7 +136,6 @@ fn test_pow_power_2_all() { #[test] -#[available_gas(2000000)] fn pow_test() { assert_eq!(pow::(200, 0), 1); assert_eq!(pow::(5, 9), 1953125); @@ -149,7 +147,6 @@ fn pow_test() { // Test counting of number of digits function #[test] -#[available_gas(2000000)] fn count_digits_of_base_test() { assert_eq!(count_digits_of_base(0, 10), 0); assert_eq!(count_digits_of_base(2, 10), 1); @@ -161,7 +158,6 @@ fn count_digits_of_base_test() { } #[test] -#[available_gas(2000000)] fn shl_should_not_overflow() { assert_eq!(BitShift::shl(pow::(2, 7), 1), 0); assert_eq!(BitShift::shl(pow::(2, 15), 1), 0); @@ -172,7 +168,6 @@ fn shl_should_not_overflow() { } #[test] -#[available_gas(3000000)] fn test_rotl_min() { assert_eq!(BitRotate::rotate_left(pow::(2, 7) + 1, 1), 3); assert_eq!(BitRotate::rotate_left(pow::(2, 15) + 1, 1), 3); @@ -183,7 +178,6 @@ fn test_rotl_min() { } #[test] -#[available_gas(3000000)] fn test_rotl_max() { assert_eq!(BitRotate::rotate_left(0b101, 7), pow::(2, 7) + 0b10); assert_eq!(BitRotate::rotate_left(0b101, 15), pow::(2, 15) + 0b10); @@ -194,7 +188,6 @@ fn test_rotl_max() { } #[test] -#[available_gas(4000000)] fn test_rotr_min() { assert_eq!(BitRotate::rotate_right(pow::(2, 7) + 1, 1), 0b11 * pow(2, 6)); assert_eq!(BitRotate::rotate_right(pow::(2, 15) + 1, 1), 0b11 * pow(2, 14)); @@ -205,7 +198,6 @@ fn test_rotr_min() { } #[test] -#[available_gas(2000000)] fn test_rotr_max() { assert_eq!(BitRotate::rotate_right(0b101_u8, 7), 0b1010); assert_eq!(BitRotate::rotate_right(0b101_u16, 15), 0b1010); diff --git a/packages/math/src/tests/mod_arithmetics_test.cairo b/packages/math/src/tests/mod_arithmetics_test.cairo index e71176fd..b1e8c892 100644 --- a/packages/math/src/tests/mod_arithmetics_test.cairo +++ b/packages/math/src/tests/mod_arithmetics_test.cairo @@ -8,7 +8,6 @@ const pow_256_minus_1: u256 = 115792089237316195423570985008687907853269984665640564039457584007913129639935; #[test] -#[available_gas(500000000)] fn add_mod_p_test() { let prime_non_zero = p.try_into().unwrap(); @@ -22,14 +21,12 @@ fn add_mod_p_test() { } #[test] -#[available_gas(500000000)] fn add_mod_2_test() { assert_eq!(add_mod(p, 2, 2), 1); assert_eq!(add_mod(p, 1, 2), 0); } #[test] -#[available_gas(500000000)] fn add_mod_1_test() { assert_eq!(add_mod(p, 2, 1), 0); assert_eq!(add_mod(p, p, 1), 0); @@ -37,7 +34,6 @@ fn add_mod_1_test() { } #[test] -#[available_gas(500000000)] fn sub_mod_test() { assert_eq!(sub_mod(p, p, p), 0); assert_eq!(sub_mod(p, 1, p), (p - 1)); @@ -50,7 +46,6 @@ fn sub_mod_test() { } #[test] -#[available_gas(500000000)] fn sub_mod_1_test() { assert_eq!(sub_mod(p, p, 1), 0); assert_eq!(sub_mod(p, 1, 1), 0); @@ -63,7 +58,6 @@ fn sub_mod_1_test() { } #[test] -#[available_gas(500000000)] fn sub_mod_2_test() { assert_eq!(sub_mod(p, p, 2), 0); assert_eq!(sub_mod(p, 1, 2), 0); @@ -76,7 +70,6 @@ fn sub_mod_2_test() { } #[test] -#[available_gas(500000000)] fn mult_mod_test() { let prime_non_zero = p.try_into().unwrap(); assert_eq!(mult_mod(p, p, prime_non_zero), 0); @@ -90,7 +83,6 @@ fn mult_mod_test() { } #[test] -#[available_gas(500000000)] fn mult_mod_1_test() { assert_eq!(mult_mod(p, p, 1), 0); assert_eq!(mult_mod(p, 1, 1), 0); @@ -103,7 +95,6 @@ fn mult_mod_1_test() { } #[test] -#[available_gas(500000000)] fn mult_mod_2_test() { assert_eq!(mult_mod(p, p, 2), 1); assert_eq!(mult_mod(p, 1, 2), 1); @@ -116,7 +107,6 @@ fn mult_mod_2_test() { } #[test] -#[available_gas(500000000)] fn sqr_mod_test() { assert_eq!(sqr_mod(p, 2), 1); assert_eq!( @@ -132,7 +122,6 @@ fn sqr_mod_test() { } #[test] -#[available_gas(500000000)] fn div_mod_test() { let prime_non_zero = p.try_into().unwrap(); let div_10_30_mod_p = @@ -143,7 +132,6 @@ fn div_mod_test() { } #[test] -#[available_gas(500000000)] fn pow_mod_test() { let prime_non_zero = p.try_into().unwrap(); assert_eq!(pow_mod(2, 4, prime_non_zero), 16); @@ -158,7 +146,6 @@ fn pow_mod_test() { } #[test] -#[available_gas(500000000)] fn pow_mod_1_test() { assert_eq!(pow_mod(2, 4, 1), 0); assert_eq!(pow_mod(2, 256, 1), 0); @@ -169,7 +156,6 @@ fn pow_mod_1_test() { } #[test] -#[available_gas(500000000)] fn pow_mod_2_test() { assert_eq!(pow_mod(2, 4, 2), 0); assert_eq!(pow_mod(2, 256, 2), 0); diff --git a/packages/math/src/tests/perfect_number_test.cairo b/packages/math/src/tests/perfect_number_test.cairo index c38d6c72..fd8786d1 100644 --- a/packages/math/src/tests/perfect_number_test.cairo +++ b/packages/math/src/tests/perfect_number_test.cairo @@ -2,34 +2,29 @@ use alexandria_math::perfect_number::{is_perfect_number, perfect_numbers}; // is_perfect_number #[test] -#[available_gas(2000000)] fn perfect_small_number_test() { assert!(is_perfect_number(6), "invalid result"); assert!(is_perfect_number(28), "invalid result"); } #[test] -#[available_gas(20000000)] fn perfect_big_number_test() { assert!(is_perfect_number(496), "invalid result"); } #[test] -#[available_gas(20000000)] fn not_perfect_small_number_test() { assert!(!is_perfect_number(5), "invalid result"); assert!(!is_perfect_number(86), "invalid result"); } #[test] -#[available_gas(20000000)] fn not_perfect_big_number_test() { assert!(!is_perfect_number(497), "invalid result"); } // perfect_numbers #[test] -#[available_gas(2000000)] fn perfect_numbers_test() { let mut res = perfect_numbers(10); assert_eq!(res.len(), 1); diff --git a/packages/math/src/tests/sha256_test.cairo b/packages/math/src/tests/sha256_test.cairo index b3a1f04c..a8d343f0 100644 --- a/packages/math/src/tests/sha256_test.cairo +++ b/packages/math/src/tests/sha256_test.cairo @@ -1,7 +1,6 @@ use alexandria_math::sha256; #[test] -#[available_gas(2000000000)] fn sha256_empty_test() { let mut input: Array = array![]; let result = sha256::sha256(input); @@ -43,7 +42,6 @@ fn sha256_empty_test() { } #[test] -#[available_gas(200000000000)] fn sha256_random_data_test() { let mut input: Array = array![ 0x57, 0x77, 0x71, 0x71, 0x66, 0x50, 0x45, 0x51, 0x51, 0x43, 0x39, 0x48, 0x38 @@ -84,7 +82,6 @@ fn sha256_random_data_test() { } #[test] -#[available_gas(2000000000)] fn sha256_lorem_ipsum_test() { // Lorem ipsum, or lsipsum as it is sometimes known, is dummy text used in laying out print, // graphic or web designs. @@ -452,7 +449,6 @@ fn sha256_lorem_ipsum_test() { assert_eq!(*result[31], 0x44); } #[test] -#[available_gas(10_000_000_000)] fn sha256_url() { let data = array![ '{', diff --git a/packages/math/src/tests/sha512_test.cairo b/packages/math/src/tests/sha512_test.cairo index 0cb2142b..5aaec788 100644 --- a/packages/math/src/tests/sha512_test.cairo +++ b/packages/math/src/tests/sha512_test.cairo @@ -328,7 +328,6 @@ fn get_lorem_ipsum() -> Array { } #[test] -#[available_gas(20000000000)] fn test_sha512_lorem_ipsum() { let msg = get_lorem_ipsum(); let res = sha512(msg); @@ -402,7 +401,6 @@ fn test_sha512_lorem_ipsum() { } #[test] -#[available_gas(20000000000)] fn test_sha512_size_one() { let mut arr: Array = array![49]; let mut res = sha512(arr); @@ -476,7 +474,6 @@ fn test_sha512_size_one() { } #[test] -#[available_gas(20000000000)] fn test_size_zero() { let msg = array![]; diff --git a/packages/math/src/tests/test_keccak256.cairo b/packages/math/src/tests/test_keccak256.cairo index 4807da6f..e05b571e 100644 --- a/packages/math/src/tests/test_keccak256.cairo +++ b/packages/math/src/tests/test_keccak256.cairo @@ -1,7 +1,6 @@ use alexandria_math::keccak256::keccak256; #[test] -#[available_gas(2000000)] fn test_keccak256_empty_bytes() { let input = array![]; @@ -12,7 +11,6 @@ fn test_keccak256_empty_bytes() { } #[test] -#[available_gas(2000000)] fn test_keccak256_partial_bytes() { let input = array![0x00, 0x01, 0x02, 0x03, 0x04, 0x05]; @@ -23,7 +21,6 @@ fn test_keccak256_partial_bytes() { } #[test] -#[available_gas(2000000)] fn test_keccak256_full_u256() { let input = array![ 0x00, diff --git a/packages/math/src/tests/trigonometry_test.cairo b/packages/math/src/tests/trigonometry_test.cairo index e7be1301..c27b8607 100644 --- a/packages/math/src/tests/trigonometry_test.cairo +++ b/packages/math/src/tests/trigonometry_test.cairo @@ -3,55 +3,46 @@ use alexandria_math::trigonometry::fast_sin; use alexandria_math::trigonometry::fast_tan; #[test] -#[available_gas(200000)] fn sin_positive_test_1() { assert!(fast_sin(3000000000) == 50000000, "invalid result"); } #[test] -#[available_gas(200000)] fn sin_negative_test_1() { assert!(fast_sin(21000000000) == -50000000, "invalid result"); } #[test] -#[available_gas(200000)] fn sin_positive_test_2() { assert!(fast_sin(3500000000) == 57367231, "invalid result"); } #[test] -#[available_gas(200000)] fn sin_negative_test_2() { assert!(fast_sin(24300000000) == -89101846, "invalid result"); } #[test] -#[available_gas(200000)] fn sin_positive_test_3() { assert!(fast_sin(75000000000) == 50000000, "invalid result"); } #[test] -#[available_gas(200000)] fn cos_positive_test_1() { assert!(fast_cos(6000000000) == 50000000, "invalid result"); } #[test] -#[available_gas(200000)] fn cos_negative_test_1() { assert!(fast_cos(12000000000) == -50000000, "invalid result"); } #[test] -#[available_gas(200000)] fn tan_positive_test_1() { assert!(fast_tan(4500000000) == 100000000, "invalid result"); } #[test] -#[available_gas(200000)] fn tan_negative_test_1() { assert!(fast_tan(-4500000000) == -100000000, "invalid result"); } diff --git a/packages/math/src/tests/wad_ray_math_test.cairo b/packages/math/src/tests/wad_ray_math_test.cairo index d105b400..2ffd5b9a 100644 --- a/packages/math/src/tests/wad_ray_math_test.cairo +++ b/packages/math/src/tests/wad_ray_math_test.cairo @@ -5,7 +5,6 @@ use alexandria_math::{pow}; // conversion #[test] -#[available_gas(2000000)] fn test_wad_to_ray_conversion() { let a = 5 * pow(10, 17); // 0.5e18 let expected = 5 * pow(10, 26); // 0.5e27 @@ -13,7 +12,6 @@ fn test_wad_to_ray_conversion() { } #[test] -#[available_gas(2000000)] fn test_ray_to_wad_conversion() { let a = 5 * pow(10, 26); // 0.5e27 let expected = 5 * pow(10, 17); // 0.5e18 @@ -22,14 +20,12 @@ fn test_ray_to_wad_conversion() { // wad #[test] -#[available_gas(2000000)] #[should_panic()] fn test_revertWhen_wad_mul_overflow() { wad_mul(pow(2, 128), pow(2, 128)); } #[test] -#[available_gas(2000000)] fn test_wad_mul_trivial() { assert_eq!(wad_mul(pow(2, 128) - 1, wad()), pow(2, 128) - 1); assert_eq!(wad_mul(0, 0), 0); @@ -39,7 +35,6 @@ fn test_wad_mul_trivial() { } #[test] -#[available_gas(2000000)] fn test_wad_mul_fractions() { let val: u256 = 2 * pow(10, 17); // 0.2e18 assert_eq!(wad_mul(wad(), val), val); @@ -47,14 +42,12 @@ fn test_wad_mul_fractions() { } #[test] -#[available_gas(2000000)] #[should_panic()] fn test_revertWhen_wad_div_zero() { wad_div(wad(), 0); } #[test] -#[available_gas(3000000)] fn test_wad_div_trivial() { assert_eq!(wad_div(pow(2, 128) - 1, wad()), pow(2, 128) - 1); assert_eq!(wad_div(0, pow(2, 128) - 1), 0); @@ -62,14 +55,12 @@ fn test_wad_div_trivial() { } #[test] -#[available_gas(2000000)] fn test_wad_div_fractions() { assert_eq!(wad_div(wad() * 2, wad() * 2), wad()); assert_eq!(wad_div(wad(), wad() * 2), half_wad()); } #[test] -#[available_gas(2000000)] fn test_wad_mul_rounding() { let a = 950000000000005647; let b = 1000000000; @@ -79,7 +70,6 @@ fn test_wad_mul_rounding() { } #[test] -#[available_gas(2000000)] fn test_wad_mul_rounding_up() { let a = pow(10, 18) - 1; let b = 2; @@ -91,14 +81,12 @@ fn test_wad_mul_rounding_up() { // wad #[test] -#[available_gas(2000000)] #[should_panic()] fn test_revertWhen_ray_mul_overflow() { ray_mul(pow(2, 128), pow(2, 128)); } #[test] -#[available_gas(2000000)] fn test_ray_mul_trivial() { assert_eq!(ray_mul(pow(2, 128) - 1, ray()), pow(2, 128) - 1); assert_eq!(ray_mul(0, 0), 0); @@ -108,7 +96,6 @@ fn test_ray_mul_trivial() { } #[test] -#[available_gas(2000000)] fn test_ray_mul_fractions() { let val: u256 = 2 * pow(10, 26); // 0.2e27 assert_eq!(ray_mul(ray(), val), val); @@ -116,14 +103,12 @@ fn test_ray_mul_fractions() { } #[test] -#[available_gas(2000000)] #[should_panic()] fn test_revertWhen_ray_div_zero() { ray_div(ray(), 0); } #[test] -#[available_gas(3000000)] fn test_ray_div_trivial() { assert_eq!(ray_div(pow(2, 128) - 1, ray()), pow(2, 128) - 1); assert_eq!(ray_div(0, pow(2, 128) - 1), 0); @@ -131,14 +116,12 @@ fn test_ray_div_trivial() { } #[test] -#[available_gas(2000000)] fn test_ray_div_fractions() { assert_eq!(ray_div(ray() * 2, ray() * 2), ray()); assert_eq!(ray_div(ray(), ray() * 2), half_ray()); } #[test] -#[available_gas(2000000)] fn test_ray_mul_rounding() { let a = pow(10, 18); let b = 95 * pow(10, 26) + 5647; @@ -149,7 +132,6 @@ fn test_ray_mul_rounding() { #[test] -#[available_gas(2000000)] fn test_ray_mul_rounding_up() { let a = pow(10, 27) - 1; let b = 2; diff --git a/packages/math/src/tests/zellers_congruence_test.cairo b/packages/math/src/tests/zellers_congruence_test.cairo index 8f1a64a1..3bc79f34 100644 --- a/packages/math/src/tests/zellers_congruence_test.cairo +++ b/packages/math/src/tests/zellers_congruence_test.cairo @@ -14,7 +14,6 @@ fn test_case(day: u128, month: u128, year: u128, expected: u128, error_expected: } #[test] -#[available_gas(2000000)] fn zellers_congruence_test() { test_case(25_u128, 1_u128, 2013_u128, 6_u128, false); test_case(16_u128, 4_u128, 2022_u128, 0_u128, false); @@ -23,7 +22,6 @@ fn zellers_congruence_test() { } #[test] -#[available_gas(2000000)] fn zellers_congruence_invalid_parameters_test() { // Invalid day // Must be between 1 and 31 diff --git a/packages/merkle_tree/Scarb.toml b/packages/merkle_tree/Scarb.toml index 29fa0ab8..2173c400 100644 --- a/packages/merkle_tree/Scarb.toml +++ b/packages/merkle_tree/Scarb.toml @@ -9,4 +9,9 @@ edition = "2023_11" fmt.workspace = true [dev-dependencies] -cairo_test.workspace = true \ No newline at end of file +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/merkle_tree/src/tests/merkle_tree_test.cairo b/packages/merkle_tree/src/tests/merkle_tree_test.cairo index 464e0984..18836a18 100644 --- a/packages/merkle_tree/src/tests/merkle_tree_test.cairo +++ b/packages/merkle_tree/src/tests/merkle_tree_test.cairo @@ -53,7 +53,6 @@ mod regular_call_merkle_tree_pedersen { } #[test] -#[available_gas(2000000)] fn merkle_tree_pedersen_test() { // [Setup] Merkle tree. let mut merkle_tree: MerkleTree = MerkleTreeImpl::<_, PedersenHasherImpl>::new(); @@ -102,7 +101,6 @@ fn merkle_tree_pedersen_test() { } #[test] -#[available_gas(50000000000)] fn merkle_tree_poseidon_test() { // [Setup] Merkle tree. let mut merkle_tree: MerkleTree = MerkleTreeImpl::<_, PoseidonHasherImpl>::new(); diff --git a/packages/merkle_tree/src/tests/storage_proof_test.cairo b/packages/merkle_tree/src/tests/storage_proof_test.cairo index 3deee73f..033da9d3 100644 --- a/packages/merkle_tree/src/tests/storage_proof_test.cairo +++ b/packages/merkle_tree/src/tests/storage_proof_test.cairo @@ -8,7 +8,6 @@ const DAI: felt252 = 0x00da114221cb83fa859dbdb4c44beeaa0bb37c7537ad5ae66fe5e0efd const ETH: felt252 = 0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7; #[test] -#[available_gas(2000000)] fn balance_lsb_proof_test() { let state_commitment = 0x07dc88984a2d8f9c2a6d2d431b2d8f2c32957da514c16ceef0761b6933121708; let contract_address = DAI; @@ -20,7 +19,7 @@ fn balance_lsb_proof_test() { } #[test] -#[should_panic(expected: ('invalid proof path',))] +#[should_panic(expected: 'invalid proof path')] #[available_gas(2000000)] fn balance_msb_proof_test() { let state_commitment = 0x07dc88984a2d8f9c2a6d2d431b2d8f2c32957da514c16ceef0761b6933121708; @@ -33,7 +32,7 @@ fn balance_msb_proof_test() { } #[test] -#[should_panic(expected: ('invalid node hash',))] +#[should_panic(expected: 'invalid node hash')] #[available_gas(2000000)] fn wrong_contract_address_proof_test() { let state_commitment = 0x07dc88984a2d8f9c2a6d2d431b2d8f2c32957da514c16ceef0761b6933121708; @@ -46,7 +45,6 @@ fn wrong_contract_address_proof_test() { } #[test] -#[available_gas(50000000)] fn total_balance_lsb_proof_test() { let state_commitment = 0x07dc88984a2d8f9c2a6d2d431b2d8f2c32957da514c16ceef0761b6933121708; let contract_address = DAI; diff --git a/packages/numeric/Scarb.toml b/packages/numeric/Scarb.toml index 05d112fd..425de5ae 100644 --- a/packages/numeric/Scarb.toml +++ b/packages/numeric/Scarb.toml @@ -13,4 +13,9 @@ alexandria_math = { path = "../math" } alexandria_searching = { path = "../searching" } [dev-dependencies] -cairo_test.workspace = true \ No newline at end of file +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/numeric/src/tests/cumprod_test.cairo b/packages/numeric/src/tests/cumprod_test.cairo index f41dc296..1e16e64c 100644 --- a/packages/numeric/src/tests/cumprod_test.cairo +++ b/packages/numeric/src/tests/cumprod_test.cairo @@ -1,7 +1,6 @@ use alexandria_numeric::cumprod::cumprod; #[test] -#[available_gas(2000000)] fn cumprod_test() { let xs: Array = array![3, 5, 7]; let ys = cumprod(xs.span()); @@ -11,7 +10,7 @@ fn cumprod_test() { } #[test] -#[should_panic(expected: ('Array must have at least 1 elt',))] +#[should_panic(expected: 'Array must have at least 1 elt')] #[available_gas(2000000)] fn cumprod_test_revert_empty() { let xs: Array = array![]; diff --git a/packages/numeric/src/tests/cumsum_test.cairo b/packages/numeric/src/tests/cumsum_test.cairo index 398d5835..1f7e65d9 100644 --- a/packages/numeric/src/tests/cumsum_test.cairo +++ b/packages/numeric/src/tests/cumsum_test.cairo @@ -1,7 +1,6 @@ use alexandria_numeric::cumsum::cumsum; #[test] -#[available_gas(2000000)] fn cumsum_test() { let xs: Array = array![3, 5, 7]; let ys = cumsum(xs.span()); @@ -11,7 +10,7 @@ fn cumsum_test() { } #[test] -#[should_panic(expected: ('Array must have at least 1 elt',))] +#[should_panic(expected: 'Array must have at least 1 elt')] #[available_gas(2000000)] fn cumsum_test_revert_empty() { let xs: Array = array![]; diff --git a/packages/numeric/src/tests/diff_test.cairo b/packages/numeric/src/tests/diff_test.cairo index 4623458d..43bc6235 100644 --- a/packages/numeric/src/tests/diff_test.cairo +++ b/packages/numeric/src/tests/diff_test.cairo @@ -1,7 +1,6 @@ use alexandria_numeric::diff::diff; #[test] -#[available_gas(2000000)] fn diff_test() { let xs = array![3, 5, 7]; let ys = diff(xs.span()); @@ -11,7 +10,7 @@ fn diff_test() { } #[test] -#[should_panic(expected: ('Sequence must be sorted',))] +#[should_panic(expected: 'Sequence must be sorted')] #[available_gas(2000000)] fn diff_test_revert_not_sorted() { let xs: Array = array![3, 2]; @@ -19,7 +18,7 @@ fn diff_test_revert_not_sorted() { } #[test] -#[should_panic(expected: ('Array must have at least 1 elt',))] +#[should_panic(expected: 'Array must have at least 1 elt')] #[available_gas(2000000)] fn diff_test_revert_empty() { let xs: Array = array![]; diff --git a/packages/numeric/src/tests/integers_test.cairo b/packages/numeric/src/tests/integers_test.cairo index 0e08e59e..af18d011 100644 --- a/packages/numeric/src/tests/integers_test.cairo +++ b/packages/numeric/src/tests/integers_test.cairo @@ -1,7 +1,6 @@ use alexandria_numeric::integers::UIntBytes; #[test] -#[available_gas(2000000)] fn test_u32_from_bytes() { let input: Array = array![0xf4, 0x32, 0x15, 0x62]; let res: Option = UIntBytes::from_bytes(input.span()); @@ -11,7 +10,6 @@ fn test_u32_from_bytes() { } #[test] -#[available_gas(2000000)] fn test_u32_from_bytes_too_big() { let input: Array = array![0xf4, 0x32, 0x15, 0x62, 0x01]; let res: Option = UIntBytes::from_bytes(input.span()); @@ -21,7 +19,6 @@ fn test_u32_from_bytes_too_big() { #[test] -#[available_gas(2000000)] fn test_u32_to_bytes_full() { let input: u32 = 0xf4321562; let res: Span = input.to_bytes(); @@ -34,7 +31,6 @@ fn test_u32_to_bytes_full() { } #[test] -#[available_gas(2000000)] fn test_u32_to_bytes_partial() { let input: u32 = 0xf43215; let res: Span = input.to_bytes(); @@ -47,7 +43,6 @@ fn test_u32_to_bytes_partial() { #[test] -#[available_gas(2000000)] fn test_u32_to_bytes_leading_zeros() { let input: u32 = 0x00f432; let res: Span = input.to_bytes(); diff --git a/packages/numeric/src/tests/interpolate_fast_test.cairo b/packages/numeric/src/tests/interpolate_fast_test.cairo index 35be611f..bfa32156 100644 --- a/packages/numeric/src/tests/interpolate_fast_test.cairo +++ b/packages/numeric/src/tests/interpolate_fast_test.cairo @@ -3,7 +3,6 @@ use alexandria_numeric::interpolate::{ }; #[test] -#[available_gas(2000000)] fn interp_extrapolation_test() { let xs: Array:: = array![3, 5, 7]; let ys = array![11, 13, 17]; @@ -18,7 +17,6 @@ fn interp_extrapolation_test() { } #[test] -#[available_gas(2000000)] fn interp_linear_test() { let xs: Array:: = array![3, 5, 7]; let ys = array![11, 13, 17]; @@ -31,7 +29,6 @@ fn interp_linear_test() { } #[test] -#[available_gas(2000000)] fn interp_nearest_test() { let xs: Array:: = array![3, 5, 7]; let ys = array![11, 13, 17]; @@ -47,7 +44,6 @@ fn interp_nearest_test() { } #[test] -#[available_gas(2000000)] fn interp_constant_left_test() { let xs: Array:: = array![3, 5, 7]; let ys = array![11, 13, 17]; @@ -66,7 +62,6 @@ fn interp_constant_left_test() { } #[test] -#[available_gas(2000000)] fn interp_constant_left_diff() { let xs: Span = array![0, 2, 4, 6, 8].span(); let ys: Span = array![0, 2, 4, 6, 8].span(); @@ -85,7 +80,6 @@ fn interp_constant_left_diff() { } #[test] -#[available_gas(2000000)] fn interp_constant_right_test() { let xs: Array:: = array![3, 5, 8]; let ys = array![11, 13, 17]; @@ -104,7 +98,7 @@ fn interp_constant_right_test() { } #[test] -#[should_panic(expected: ("Arrays must have the same len",))] +#[should_panic(expected: "Arrays must have the same len")] #[available_gas(2000000)] fn interp_revert_len_mismatch() { let xs: Array:: = array![3, 5]; @@ -113,7 +107,7 @@ fn interp_revert_len_mismatch() { } #[test] -#[should_panic(expected: ("Array must have at least 2 elts",))] +#[should_panic(expected: "Array must have at least 2 elts")] #[available_gas(2000000)] fn interp_revert_len_too_short() { let xs: Array:: = array![3]; diff --git a/packages/numeric/src/tests/interpolate_test.cairo b/packages/numeric/src/tests/interpolate_test.cairo index 45f4f78b..c7a6c033 100644 --- a/packages/numeric/src/tests/interpolate_test.cairo +++ b/packages/numeric/src/tests/interpolate_test.cairo @@ -1,7 +1,6 @@ use alexandria_numeric::interpolate::{interpolate, Interpolation, Extrapolation}; #[test] -#[available_gas(2000000)] fn interp_extrapolation_test() { let xs: Array:: = array![3, 5, 7]; let ys = array![11, 13, 17]; @@ -16,7 +15,6 @@ fn interp_extrapolation_test() { } #[test] -#[available_gas(2000000)] fn interp_linear_test() { let xs: Array:: = array![3, 5, 7]; let ys = array![11, 13, 17]; @@ -29,7 +27,6 @@ fn interp_linear_test() { } #[test] -#[available_gas(2000000)] fn interp_nearest_test() { let xs: Array:: = array![3, 5, 7]; let ys = array![11, 13, 17]; @@ -45,7 +42,6 @@ fn interp_nearest_test() { } #[test] -#[available_gas(2000000)] fn interp_constant_left_test() { let xs: Array:: = array![3, 5, 7]; let ys = array![11, 13, 17]; @@ -64,7 +60,6 @@ fn interp_constant_left_test() { } #[test] -#[available_gas(2000000)] fn interp_constant_right_test() { let xs: Array:: = array![3, 5, 8]; let ys = array![11, 13, 17]; @@ -83,7 +78,7 @@ fn interp_constant_right_test() { } #[test] -#[should_panic(expected: ("Arrays must have the same len",))] +#[should_panic(expected: "Arrays must have the same len")] #[available_gas(2000000)] fn interp_revert_len_mismatch() { let xs: Array:: = array![3, 5]; @@ -92,7 +87,7 @@ fn interp_revert_len_mismatch() { } #[test] -#[should_panic(expected: ("Array must have at least 2 elts",))] +#[should_panic(expected: "Array must have at least 2 elts")] #[available_gas(2000000)] fn interp_revert_len_too_short() { let xs: Array:: = array![3]; diff --git a/packages/numeric/src/tests/trapezoidal_rule_test.cairo b/packages/numeric/src/tests/trapezoidal_rule_test.cairo index 526a95de..de34f5bb 100644 --- a/packages/numeric/src/tests/trapezoidal_rule_test.cairo +++ b/packages/numeric/src/tests/trapezoidal_rule_test.cairo @@ -1,7 +1,6 @@ use alexandria_numeric::trapezoidal_rule::trapezoidal_rule; #[test] -#[available_gas(2000000)] fn trapezoidal_rule_test() { let xs: Array:: = array![3, 5, 7]; let ys = array![11, 13, 17]; @@ -9,7 +8,7 @@ fn trapezoidal_rule_test() { } #[test] -#[should_panic(expected: ('Arrays must have the same len',))] +#[should_panic(expected: 'Arrays must have the same len')] #[available_gas(2000000)] fn trapezoidal_rule_test_revert_len_mismatch() { let xs: Array:: = array![3]; @@ -18,7 +17,7 @@ fn trapezoidal_rule_test_revert_len_mismatch() { } #[test] -#[should_panic(expected: ('Array must have at least 2 elts',))] +#[should_panic(expected: 'Array must have at least 2 elts')] #[available_gas(2000000)] fn trapezoidal_rule_test_revert_len_too_short() { let xs: Array:: = array![3]; @@ -27,7 +26,7 @@ fn trapezoidal_rule_test_revert_len_too_short() { } #[test] -#[should_panic(expected: ('Abscissa must be sorted',))] +#[should_panic(expected: 'Abscissa must be sorted')] #[available_gas(2000000)] fn trapezoidal_rule_test_revert_not_sorted() { let xs: Array:: = array![5, 3]; diff --git a/packages/searching/Scarb.toml b/packages/searching/Scarb.toml index 1547ca76..ab3a36df 100644 --- a/packages/searching/Scarb.toml +++ b/packages/searching/Scarb.toml @@ -13,4 +13,9 @@ fmt.workspace = true alexandria_data_structures = { path = "../data_structures" } [dev-dependencies] -cairo_test.workspace = true \ No newline at end of file +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/searching/src/tests/binary_search_closest_test.cairo b/packages/searching/src/tests/binary_search_closest_test.cairo index e14dd829..9251ab30 100644 --- a/packages/searching/src/tests/binary_search_closest_test.cairo +++ b/packages/searching/src/tests/binary_search_closest_test.cairo @@ -1,7 +1,6 @@ use alexandria_searching::binary_search::binary_search_closest as search; #[test] -#[available_gas(2000000)] fn value_found() { let mut arr: Array = array![100, 200, 300, 400, 500, 600]; @@ -28,7 +27,6 @@ fn value_found() { } #[test] -#[available_gas(2000000)] fn value_not_found() { let mut arr: Array = array![100, 200, 300, 400, 500, 600]; @@ -47,7 +45,6 @@ fn value_not_found() { } #[test] -#[available_gas(2000000)] fn value_found_length_one() { let span: Span = array![100].span(); @@ -55,14 +52,12 @@ fn value_found_length_one() { } #[test] -#[available_gas(2000000)] fn value_not_found_length_one() { let span: Span = array![100].span(); assert!(search(span, 50).is_none(), "value was found") } #[test] -#[available_gas(2000000)] fn zero_length_span() { let span: Span = array![].span(); assert!(search(span, 100).is_none(), "value was found") @@ -71,7 +66,6 @@ fn zero_length_span() { // Closest specific tests #[test] -#[available_gas(1_000_000)] fn length_two_span() { let span: Span = array![100, 200].span(); assert!(search(span, 50).is_none()); @@ -82,7 +76,6 @@ fn length_two_span() { } #[test] -#[available_gas(1_000_000)] fn length_three_span() { let span: Span = array![100, 200, 300].span(); assert!(search(span, 50).is_none()); @@ -95,7 +88,6 @@ fn length_three_span() { } #[test] -#[available_gas(2000000)] fn closest_value_found() { let mut arr: Array = array![100, 200, 300, 400, 500, 600]; @@ -120,7 +112,6 @@ fn closest_value_found() { } #[test] -#[available_gas(5_000_000)] fn all_values() { let mut arr: Array = array![100, 200, 300, 400, 500, 600]; diff --git a/packages/searching/src/tests/binary_search_test.cairo b/packages/searching/src/tests/binary_search_test.cairo index 693649ab..c1e4cd35 100644 --- a/packages/searching/src/tests/binary_search_test.cairo +++ b/packages/searching/src/tests/binary_search_test.cairo @@ -1,7 +1,6 @@ use alexandria_searching::binary_search::binary_search; #[test] -#[available_gas(2000000)] fn value_found() { let mut arr: Array = array![100, 200, 300, 400, 500, 600]; @@ -28,7 +27,6 @@ fn value_found() { } #[test] -#[available_gas(2000000)] fn value_not_found() { let mut arr: Array = array![100, 200, 300, 400, 500, 600]; @@ -47,21 +45,18 @@ fn value_not_found() { } #[test] -#[available_gas(2000000)] fn value_found_length_one() { let span: Span = array![100].span(); assert_eq!(binary_search(span, 100).unwrap(), 0, "value was not found") } #[test] -#[available_gas(2000000)] fn value_not_found_length_one() { let span: Span = array![100].span(); assert!(binary_search(span, 50).is_none(), "value was found") } #[test] -#[available_gas(2000000)] fn zero_length_span() { let span: Span = array![].span(); assert!(binary_search(span, 100).is_none(), "value was found") diff --git a/packages/searching/src/tests/bm_search_test.cairo b/packages/searching/src/tests/bm_search_test.cairo index ee4842a1..2afd9b0a 100644 --- a/packages/searching/src/tests/bm_search_test.cairo +++ b/packages/searching/src/tests/bm_search_test.cairo @@ -1,7 +1,6 @@ use alexandria_searching::bm_search::bm_search; #[test] -#[available_gas(5000000)] fn bm_search_test_1() { // AABCAB12AFAABCABFFEGABCAB -> // 41,41,42,43,41,42,31,32,41,46,41,41,42,43,41,42,46,46,45,47,41,42,43,41,42 @@ -45,7 +44,6 @@ fn bm_search_test_1() { } #[test] -#[available_gas(5000000)] fn bm_search_test_2() { // AABCAB12AFAABCABFFEGABCAB -> // 41,41,42,43,41,42,31,32,41,46,41,41,42,43,41,42,46,46,45,47,41,42,43,41,42 @@ -87,7 +85,6 @@ fn bm_search_test_2() { } #[test] -#[available_gas(5000000)] fn bm_search_test_3() { // AABCAB12AFAABCABFFEGABCAB -> // 41,41,42,43,41,42,31,32,41,46,41,41,42,43,41,42,46,46,45,47,41,42,43,41,42 diff --git a/packages/searching/src/tests/dijkstra_test.cairo b/packages/searching/src/tests/dijkstra_test.cairo index 05e90717..067383d0 100644 --- a/packages/searching/src/tests/dijkstra_test.cairo +++ b/packages/searching/src/tests/dijkstra_test.cairo @@ -3,7 +3,6 @@ use core::nullable::{FromNullableResult, match_nullable}; #[test] -#[available_gas(2000000)] fn add_edge() { let source = 0_u32; let dest = 1_u32; @@ -46,7 +45,6 @@ fn add_edge() { #[test] -#[available_gas(1500000)] fn calculate_shortest_path() { let mut graph = GraphTrait::new(); GraphTrait::add_edge(ref graph, 0, 1, 5); @@ -68,7 +66,6 @@ fn calculate_shortest_path() { } #[test] -#[available_gas(2000000)] fn calculate_shortest_path_random() { let mut graph = GraphTrait::new(); GraphTrait::add_edge(ref graph, 0, 2, 4); @@ -89,7 +86,6 @@ fn calculate_shortest_path_random() { #[test] -#[available_gas(1050000)] fn calculate_shortest_path_node_visited() { let mut graph = GraphTrait::new(); GraphTrait::add_edge(ref graph, 0, 1, 5); @@ -108,4 +104,3 @@ fn calculate_shortest_path_node_visited() { assert_eq!(results.get(4.into()), 3); assert_eq!(results.get(5.into()), 3); } - diff --git a/packages/searching/src/tests/levenshtein_distance_test.cairo b/packages/searching/src/tests/levenshtein_distance_test.cairo index 6bed89c3..3fbd3853 100644 --- a/packages/searching/src/tests/levenshtein_distance_test.cairo +++ b/packages/searching/src/tests/levenshtein_distance_test.cairo @@ -2,7 +2,6 @@ use alexandria_searching::levenshtein_distance::levenshtein_distance; #[test] -#[available_gas(5000000)] fn bm_search_test_1() { // FROG -> 46,52,4f,47 let mut arr1: ByteArray = Default::default(); @@ -21,7 +20,6 @@ fn bm_search_test_1() { } #[test] -#[available_gas(5000000)] fn bm_search_test_2() { let mut arr1: ByteArray = Default::default(); let mut arr2: ByteArray = Default::default(); @@ -31,7 +29,6 @@ fn bm_search_test_2() { } #[test] -#[available_gas(5000000)] fn bm_search_test_3() { let mut arr1: ByteArray = Default::default(); let mut arr2: ByteArray = Default::default(); @@ -42,7 +39,6 @@ fn bm_search_test_3() { } #[test] -#[available_gas(5000000)] fn bm_search_test_4() { let mut arr1: ByteArray = Default::default(); arr1.append_byte(0x61_u8); @@ -53,7 +49,6 @@ fn bm_search_test_4() { } #[test] -#[available_gas(5000000)] fn bm_search_test_5() { let mut arr1: ByteArray = Default::default(); arr1.append_byte(0x61_u8); @@ -66,7 +61,6 @@ fn bm_search_test_5() { } #[test] -#[available_gas(5000000)] fn bm_search_test_6() { // foobar -> 66,6f,6f,62,61,72 let mut arr1: ByteArray = Default::default(); @@ -90,7 +84,6 @@ fn bm_search_test_6() { } #[test] -#[available_gas(5000000)] fn bm_search_test_7() { // foobar -> 66,6f,6f,62,61,72 let mut arr1: ByteArray = Default::default(); diff --git a/packages/sorting/Scarb.toml b/packages/sorting/Scarb.toml index 273b3ea9..3e98b0d1 100644 --- a/packages/sorting/Scarb.toml +++ b/packages/sorting/Scarb.toml @@ -12,4 +12,9 @@ fmt.workspace = true alexandria_data_structures = { path = "../data_structures" } [dev-dependencies] -cairo_test.workspace = true \ No newline at end of file +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/sorting/src/tests/bubble_sort_test.cairo b/packages/sorting/src/tests/bubble_sort_test.cairo index 88798b90..2cf86ff0 100644 --- a/packages/sorting/src/tests/bubble_sort_test.cairo +++ b/packages/sorting/src/tests/bubble_sort_test.cairo @@ -1,7 +1,6 @@ use alexandria_sorting::BubbleSort; #[test] -#[available_gas(20000000000000)] fn bubble_sort_test() { let data = array![4_u32, 2, 1, 3, 5, 0].span(); let correct = array![0_u32, 1, 2, 3, 4, 5]; @@ -13,7 +12,6 @@ fn bubble_sort_test() { #[test] -#[available_gas(2000000)] fn bubble_sort_test_empty() { let data: Span = array![].span(); let correct = array![]; @@ -24,7 +22,6 @@ fn bubble_sort_test_empty() { } #[test] -#[available_gas(2000000)] fn bubble_sort_test_one_element() { let data = array![2_u32].span(); let correct = array![2_u32]; @@ -35,7 +32,6 @@ fn bubble_sort_test_one_element() { } #[test] -#[available_gas(2000000)] fn bubble_sort_test_pre_sorted() { let data = array![1_u32, 2, 3, 4].span(); let correct = array![1_u32, 2, 3, 4]; @@ -46,7 +42,6 @@ fn bubble_sort_test_pre_sorted() { } #[test] -#[available_gas(2000000)] fn bubble_sort_test_pre_sorted_decreasing() { let data = array![4_u32, 3, 2, 1].span(); let correct = array![1_u32, 2, 3, 4]; @@ -57,7 +52,6 @@ fn bubble_sort_test_pre_sorted_decreasing() { } #[test] -#[available_gas(2000000)] fn bubble_sort_test_pre_sorted_2_same_values() { let data = array![1_u32, 2, 2, 4].span(); let correct = array![1_u32, 2, 2, 4]; @@ -68,7 +62,6 @@ fn bubble_sort_test_pre_sorted_2_same_values() { } #[test] -#[available_gas(2000000)] fn bubble_sort_test_2_same_values() { let data = array![1_u32, 2, 4, 2].span(); let correct = array![1_u32, 2, 2, 4]; diff --git a/packages/sorting/src/tests/merge_sort_test.cairo b/packages/sorting/src/tests/merge_sort_test.cairo index f8fcb242..6b47adbe 100644 --- a/packages/sorting/src/tests/merge_sort_test.cairo +++ b/packages/sorting/src/tests/merge_sort_test.cairo @@ -1,7 +1,6 @@ use alexandria_sorting::MergeSort; #[test] -#[available_gas(2000000000)] fn merge_sort_test() { let data = array![7_u32, 4, 2, 6, 1, 3, 5, 8, 0].span(); let correct = array![0_u32, 1, 2, 3, 4, 5, 6, 7, 8]; @@ -12,7 +11,6 @@ fn merge_sort_test() { } #[test] -#[available_gas(2000000)] fn merge_sort_test_2_pre_sorted_decreasing() { let data = array![4_u32, 3, 2, 1].span(); let correct = array![1_u32, 2, 3, 4]; @@ -23,7 +21,6 @@ fn merge_sort_test_2_pre_sorted_decreasing() { } #[test] -#[available_gas(2000000)] fn merge_sort_test_empty() { let data: Span = array![].span(); @@ -35,7 +32,6 @@ fn merge_sort_test_empty() { } #[test] -#[available_gas(2000000)] fn merge_sort_test_one_element() { let data = array![2_u32].span(); let correct = array![2_u32]; @@ -46,7 +42,6 @@ fn merge_sort_test_one_element() { } #[test] -#[available_gas(2000000)] fn merge_sort_test_pre_sorted() { let data = array![1_u32, 2, 3, 4].span(); let correct = array![1_u32, 2, 3, 4]; @@ -57,7 +52,6 @@ fn merge_sort_test_pre_sorted() { } #[test] -#[available_gas(2000000)] fn merge_sort_test_2_same_values() { let data = array![1_u32, 2, 3, 2, 4].span(); let correct = array![1_u32, 2, 2, 3, 4]; @@ -68,7 +62,6 @@ fn merge_sort_test_2_same_values() { } #[test] -#[available_gas(2000000)] fn merge_sort_test_2_same_values_pre_sorted() { let data = array![1_u32, 2, 2, 3, 4].span(); let correct = array![1_u32, 2, 2, 3, 4]; diff --git a/packages/sorting/src/tests/quick_sort_test.cairo b/packages/sorting/src/tests/quick_sort_test.cairo index d6ddb6ad..efb529f3 100644 --- a/packages/sorting/src/tests/quick_sort_test.cairo +++ b/packages/sorting/src/tests/quick_sort_test.cairo @@ -26,7 +26,6 @@ fn is_equal_vec(mut a: Felt252Vec, mut b: Span) -> bool { } #[test] -#[available_gas(20000000000000)] fn quicksort_test() { let mut data = VecTrait::::new(); data.push(4); @@ -44,7 +43,6 @@ fn quicksort_test() { #[test] -#[available_gas(2000000)] fn quicksort_test_empty() { let data = VecTrait::::new(); let correct = array![]; @@ -55,7 +53,6 @@ fn quicksort_test_empty() { } #[test] -#[available_gas(2000000)] fn quicksort_test_one_element() { let mut data = VecTrait::::new(); data.push(2); @@ -67,7 +64,6 @@ fn quicksort_test_one_element() { } #[test] -#[available_gas(2000000)] fn quicksort_test_pre_sorted() { let mut data = VecTrait::::new(); data.push(1); @@ -82,7 +78,6 @@ fn quicksort_test_pre_sorted() { } #[test] -#[available_gas(2000000)] fn quicksort_test_pre_sorted_decreasing() { let mut data = VecTrait::::new(); data.push(4); @@ -97,7 +92,6 @@ fn quicksort_test_pre_sorted_decreasing() { } #[test] -#[available_gas(2000000)] fn quicksort_test_pre_sorted_2_same_values() { let mut data = VecTrait::::new(); data.push(1); @@ -112,7 +106,6 @@ fn quicksort_test_pre_sorted_2_same_values() { } #[test] -#[available_gas(2000000)] fn quicksort_test_2_same_values() { let mut data = VecTrait::::new(); data.push(1); diff --git a/packages/storage/Scarb.toml b/packages/storage/Scarb.toml index 1b1bdb36..ce802432 100644 --- a/packages/storage/Scarb.toml +++ b/packages/storage/Scarb.toml @@ -12,4 +12,9 @@ fmt.workspace = true starknet.workspace = true [dev-dependencies] -cairo_test.workspace = true \ No newline at end of file +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/packages/storage/src/tests/list_test.cairo b/packages/storage/src/tests/list_test.cairo index a0ea8ea7..f99aa1cb 100644 --- a/packages/storage/src/tests/list_test.cairo +++ b/packages/storage/src/tests/list_test.cairo @@ -129,11 +129,8 @@ impl StorageBaseAddressPartialEq of PartialEq { } } -fn deploy_mock() -> IAListHolderDispatcher { - let class_hash: ClassHash = AListHolder::TEST_CLASS_HASH.try_into().unwrap(); - let ctor_data: Array = Default::default(); - let (addr, _) = deploy_syscall(class_hash, 0, ctor_data.span(), false).unwrap_syscall(); - IAListHolderDispatcher { contract_address: addr } +fn deploy_mock() -> AListHolder::ContractState { + AListHolder::contract_state_for_testing() } fn mock_addr() -> ContractAddress { @@ -141,14 +138,12 @@ fn mock_addr() -> ContractAddress { } #[test] -#[available_gas(100000000)] fn test_deploy() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); assert_eq!(contract.do_get_len(), (0, 0)); } #[test] -#[available_gas(100000000)] fn test_new_initializes_empty_list() { let mut contract_state = AListHolder::contract_state_for_testing(); @@ -172,7 +167,6 @@ fn test_new_initializes_empty_list() { } #[test] -#[available_gas(100000000)] fn test_new_then_fill_list() { let mut contract_state = AListHolder::contract_state_for_testing(); @@ -194,7 +188,6 @@ fn test_new_then_fill_list() { } #[test] -#[available_gas(100000000)] fn test_fetch_empty_list() { let storage_address = storage_base_address_from_felt252('empty_address'); @@ -207,7 +200,6 @@ fn test_fetch_empty_list() { } #[test] -#[available_gas(100000000)] fn test_fetch_existing_list() { let mut contract_state = AListHolder::contract_state_for_testing(); let mock_addr = mock_addr(); @@ -231,9 +223,8 @@ fn test_fetch_existing_list() { } #[test] -#[available_gas(100000000)] fn test_is_empty() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); assert_eq!(contract.do_is_empty(), (true, true)); contract.do_append(mock_addr(), 1337); @@ -241,9 +232,8 @@ fn test_is_empty() { } #[test] -#[available_gas(100000000)] fn test_append_few() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); assert_eq!(contract.do_append(mock_addr(), 10), (0, 0)); assert_eq!(contract.do_append(mock_addr(), 20), (1, 1)); @@ -251,9 +241,8 @@ fn test_append_few() { } #[test] -#[available_gas(100000000000)] fn test_append_get_many() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let mock_addr = mock_addr(); let mut index: u32 = 0; @@ -282,9 +271,8 @@ fn test_append_get_many() { } #[test] -#[available_gas(100000000)] fn test_get_pass() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let mock_addr = mock_addr(); contract.do_append(mock_addr, 100); // idx 0 @@ -311,18 +299,16 @@ fn test_get_pass() { } #[test] -#[available_gas(100000000)] fn test_get_empty() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let (addr, number) = contract.do_get(0); assert!(addr.is_none(), "addr is none"); assert!(number.is_none(), "number is none"); } #[test] -#[available_gas(100000000)] fn test_get_out_of_bounds() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); contract.do_append(mock_addr(), 10); let (addr, number) = contract.do_get(42); assert!(addr.is_none(), "addr is none"); @@ -330,9 +316,8 @@ fn test_get_out_of_bounds() { } #[test] -#[available_gas(100000000)] fn test_get_index_pass() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let mock_addr = mock_addr(); contract.do_append(mock_addr, 100); // idx 0 @@ -345,18 +330,16 @@ fn test_get_index_pass() { } #[test] -#[available_gas(100000000)] -#[should_panic(expected: ('List index out of bounds', 'ENTRYPOINT_FAILED'))] +#[should_panic(expected: 'List index out of bounds')] fn test_get_index_out_of_bounds() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); contract.do_append(mock_addr(), 10); contract.do_get_index(10); } #[test] -#[available_gas(100000000)] fn test_set_pass() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let mock_addr = mock_addr(); let diff_addr = starknet::contract_address_const::<'bye'>(); @@ -374,17 +357,15 @@ fn test_set_pass() { } #[test] -#[available_gas(100000000)] -#[should_panic(expected: ('List index out of bounds', 'ENTRYPOINT_FAILED'))] +#[should_panic(expected: 'List index out of bounds')] fn test_set_out_of_bounds() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); contract.do_set(2, mock_addr(), 20); } #[test] -#[available_gas(100000000)] fn test_pop_front_pass() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let mock_addr = mock_addr(); contract.do_append(mock_addr, 100); // idx 0 @@ -416,9 +397,8 @@ fn test_pop_front_pass() { } #[test] -#[available_gas(100000000)] fn test_pop_front_empty() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let (pop_addr, pop_number) = contract.do_pop_front(); assert!(pop_addr.is_none(), "pop addr none"); @@ -426,9 +406,8 @@ fn test_pop_front_empty() { } #[test] -#[available_gas(100000000)] fn test_pop_append() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); // write something contract.do_append(mock_addr(), 10); assert_eq!(contract.do_get_len(), (1, 1)); @@ -447,9 +426,8 @@ fn test_pop_append() { } #[test] -#[available_gas(100000000)] fn test_array_pass() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let mock_addr = mock_addr(); contract.do_append(mock_addr, 100); // idx 0 @@ -465,18 +443,16 @@ fn test_array_pass() { } #[test] -#[available_gas(100000000)] fn test_array_empty() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let (array_addr, array_number) = contract.do_array(); assert_eq!((array_addr.len(), array_number.len()), (0, 0)); } #[test] -#[available_gas(100000000)] fn test_array_clean() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let mock_addr = mock_addr(); contract.do_append(mock_addr, 100); // idx 0 @@ -487,9 +463,8 @@ fn test_array_clean() { } #[test] -#[available_gas(100000000)] fn test_array_clean_with_empty_array() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); assert_eq!(contract.do_get_len(), (0, 0)); @@ -499,9 +474,8 @@ fn test_array_clean_with_empty_array() { } #[test] -#[available_gas(100000000)] fn test_array_get_value_after_clean() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let mock_addr = mock_addr(); contract.do_append(mock_addr, 100); // idx 0 @@ -521,18 +495,16 @@ fn test_array_get_value_after_clean() { } #[test] -#[available_gas(100000000)] fn test_append_array_empty() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); contract.do_append_span(array![], array![]); assert_eq!(contract.do_is_empty(), (true, true)); } #[test] -#[available_gas(100000000)] fn test_append_span_existing_list() { - let contract = deploy_mock(); + let mut contract = deploy_mock(); let mock_addr = mock_addr(); assert_eq!(contract.do_append(mock_addr, 10), (0, 0)); diff --git a/packages/utils/Scarb.toml b/packages/utils/Scarb.toml index 13dddd6c..98d87889 100644 --- a/packages/utils/Scarb.toml +++ b/packages/utils/Scarb.toml @@ -10,3 +10,11 @@ fmt.workspace = true [dependencies] starknet.workspace = true + +[dev-dependencies] +assert_macros = "0.1.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } + +[scripts] +test = "snforge test" +test-profiling = "snforge test --build-profile" diff --git a/src/utils/Scarb.toml b/src/utils/Scarb.toml new file mode 100644 index 00000000..e69de29b From 51fb34421bc6f0da037962e28af99e36e2398fab Mon Sep 17 00:00:00 2001 From: enitrat Date: Thu, 29 Aug 2024 18:56:40 +0200 Subject: [PATCH 2/2] update gas report regex --- .github/workflows/test.yml | 11 +- gas_report.json | 800 ++++++--------------------------- scripts/generate_gas_report.sh | 6 +- src/utils/Scarb.toml | 0 4 files changed, 156 insertions(+), 661 deletions(-) delete mode 100644 src/utils/Scarb.toml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 81671ac1..9dfd7bf3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,12 +19,10 @@ jobs: name: test runs-on: ubuntu-latest steps: - - name: Step 1 - Check out main branch - uses: actions/checkout@v3 - - name: Step 2 - Getting scarb - uses: software-mansion/setup-scarb@v1.3.2 - - name: Step 3 - Running tests - run: scarb test + - uses: actions/checkout@v3 + - uses: foundry-rs/setup-snfoundry@v3 + - uses: software-mansion/setup-scarb@v1.3.2 + - run: scarb test check-format: needs: build @@ -47,6 +45,7 @@ jobs: uses: actions/checkout@v3 - name: Step 2 - Getting scarb uses: software-mansion/setup-scarb@v1.3.2 + - uses: foundry-rs/setup-snfoundry@v3 - name: Step 3 - Generate and compare gas report run: ./scripts/generate_gas_report.sh shell: bash diff --git a/gas_report.json b/gas_report.json index 8bfdf444..883cb0fd 100644 --- a/gas_report.json +++ b/gas_report.json @@ -1,654 +1,150 @@ { - "alexandria_data_structures::tests::bit_array::test_stress_test": 983908350, - "alexandria_math::tests::ed25519_test::verify_signature_test_3": 410362908, - "alexandria_math::tests::ed25519_test::verify_signature_test_2": 387681668, - "alexandria_math::tests::ed25519_test::verify_signature_test_0": 387034448, - "alexandria_math::tests::ed25519_test::verify_signature_invalid": 386386948, - "alexandria_math::tests::ed25519_test::verify_signature_test_1": 379915028, - "alexandria_storage::tests::list_test::tests::test_append_get_many": 328960220, - "alexandria_data_structures::tests::bit_array::test_serde_ser_deser": 135779000, - "alexandria_bytes::tests::test_bytes::test_bytes_sha256": 77008968, - "alexandria_data_structures::tests::bit_array::test_write_word_le_u512": 55010760, - "alexandria_data_structures::tests::bit_array::test_read_word_le_u512": 49918390, - "alexandria_math::tests::sha256_test::sha256_lorem_ipsum_test": 47014076, - "alexandria_data_structures::tests::bit_array::test_write_word_be_u512": 46828860, - "alexandria_data_structures::tests::bit_array::test_read_word_be_u512": 40555700, - "alexandria_math::tests::sha512_test::test_sha512_lorem_ipsum": 34928772, - "alexandria_math::tests::sha256_test::sha256_url": 31492476, - "alexandria_encoding::tests::sol_abi::sol_bytes_test": 31413290, - "alexandria_data_structures::tests::bit_array::test_write_word_le_u256": 27520470, - "alexandria_math::tests::mod_arithmetics_test::pow_mod_test": 26160370, - "alexandria_math::tests::mod_arithmetics_test::pow_mod_2_test": 26109970, - "alexandria_math::tests::mod_arithmetics_test::pow_mod_1_test": 26109970, - "alexandria_bytes::tests::test_bytes::test_byte_array_conversions": 25836200, - "alexandria_bytes::tests::test_bytes::test_bytes_update": 23797800, - "alexandria_data_structures::tests::bit_array::test_write_word_be_u256": 23429600, - "alexandria_data_structures::tests::bit_array::test_read_word_le_u256": 22449980, - "alexandria_math::tests::karatsuba_test::multiply_by_zero": 19989510, - "alexandria_encoding::tests::sol_abi::encoded_as_test": 19437510, - "alexandria_encoding::tests::sol_abi::encode_test": 18540610, - "alexandria_encoding::tests::sol_abi::decode_test": 18233290, - "alexandria_data_structures::tests::bit_array::test_read_word_be_u256": 17178550, - "alexandria_data_structures::tests::bit_array::test_append_bit": 16946680, - "alexandria_encoding::tests::sol_abi::encode_packed_test": 15552720, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_long_list": 15388648, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_string_large_bytearray_inputs": 14400236, - "alexandria_data_structures::tests::bit_array::test_write_word_le": 13745440, - "alexandria_math::tests::sha512_test::test_size_zero": 12326794, - "alexandria_math::tests::sha512_test::test_sha512_size_one": 12324284, - "alexandria_data_structures::tests::bit_array::test_write_word_be": 11700330, - "alexandria_encoding::tests::reversible_test::test_reverse_bits_u512": 11236680, - "alexandria_math::tests::karatsuba_test::multiply_same_size_positive_number": 9982920, - "alexandria_math::tests::math_test::test_pow_power_2_all": 9942780, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_string": 9641400, - "alexandria_bytes::tests::test_bytes::test_bytes_concat": 8828950, - "alexandria_data_structures::tests::bit_array::test_read_word_le_half": 8774740, - "alexandria_data_structures::tests::bit_array::test_read_word_le": 8678210, - "alexandria_math::tests::sha256_test::sha256_empty_test": 8393336, - "alexandria_math::tests::sha256_test::sha256_random_data_test": 8331016, - "alexandria_data_structures::tests::bit_array::test_at": 7832190, - "alexandria_data_structures::tests::bit_array::test_write_word_le_half": 6956440, - "alexandria_data_structures::tests::bit_array::test_write_word_be_half": 5898950, - "alexandria_data_structures::tests::bit_array::test_read_word_be_half": 5520340, - "alexandria_data_structures::tests::bit_array::test_read_word_be": 5453130, - "alexandria_math::tests::ed25519_test::verify_signature_invalid_length": 5244692, - "alexandria_encoding::tests::reversible_test::test_reverse_bits_u256": 3759980, - "alexandria_encoding::tests::reversible_test::test_reverse_bits_bytes31": 3678180, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_long_list": 3060830, - "alexandria_data_structures::tests::byte_array_ext::test_byte_array_into_array_u8": 3005940, - "alexandria_bytes::tests::test_bytes::test_bytes_read_bytes": 2994820, - "alexandria_bytes::tests::test_bytes::test_bytes_append": 2978980, - "alexandria_math::tests::fast_power_test::fast_power_mod_test": 2947540, - "alexandria_math::tests::karatsuba_test::multiply_distinct_size_positive_number": 2763330, - "alexandria_storage::tests::list_test::tests::test_append_span_existing_list": 2558830, - "alexandria_ascii::tests::test_ascii_integer::u256_to_ascii": 2547830, - "alexandria_storage::tests::list_test::tests::test_array_pass": 2537110, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u128_array_packed": 2461770, - "alexandria_bytes::tests::test_bytes::test_bytes_keccak": 2419614, - "alexandria_math::tests::perfect_number_test::not_perfect_big_number_test": 2386970, - "alexandria_storage::tests::list_test::tests::test_pop_front_pass": 2381730, - "alexandria_math::tests::perfect_number_test::perfect_big_number_test": 2381610, - "alexandria_storage::tests::list_test::tests::test_set_pass": 2340760, - "alexandria_math::tests::math_test::test_rotr_min": 1978370, - "alexandria_math::tests::fast_power_test::fast_power_test": 1911400, - "alexandria_encoding::tests::reversible_test::test_reverse_bits_u128": 1890180, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_string_length_greater_than_56": 1819186, - "alexandria_storage::tests::list_test::tests::test_get_index_pass": 1816640, - "alexandria_bytes::tests::test_bytes::test_bytes_update_panic": 1809480, - "alexandria_searching::tests::levenshtein_distance_test::bm_search_test_7": 1804240, - "alexandria_searching::tests::levenshtein_distance_test::bm_search_test_6": 1804240, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u256_array": 1717620, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_string_length_exactly_56": 1716266, - "alexandria_searching::tests::bm_search_test::bm_search_test_1": 1704080, - "alexandria_storage::tests::list_test::tests::test_pop_append": 1685530, - "alexandria_storage::tests::list_test::tests::test_get_pass": 1682170, - "alexandria_math::tests::extended_euclidean_algorithm_test::extended_euclidean_algorithm_test": 1664940, - "alexandria_searching::tests::bm_search_test::bm_search_test_3": 1575160, - "alexandria_encoding::tests::sol_abi::selector_test": 1565890, - "alexandria_math::tests::fast_root_test::fast_nr_optimize_test_1": 1538600, - "alexandria_encoding::tests::reversible_test::test_reverse_bytes_u512": 1533000, - "alexandria_encoding::tests::base64_test::base64decode_hello_world_test": 1461316, - "alexandria_data_structures::tests::byte_reader::test_read_sequence_le": 1460660, - "alexandria_data_structures::tests::byte_reader::test_read_sequence": 1460660, - "alexandria_math::tests::math_test::test_rotl_max": 1457800, - "alexandria_data_structures::tests::byte_reader::test_read_u512_le": 1426070, - "alexandria_data_structures::tests::byte_reader::test_read_u512": 1426070, - "alexandria_data_structures::tests::byte_reader::test_len": 1425410, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u128_packed": 1411760, - "alexandria_storage::tests::list_test::tests::test_array_clean": 1378450, - "alexandria_math::tests::wad_ray_math_test::test_wad_div_trivial": 1375840, - "alexandria_math::tests::wad_ray_math_test::test_ray_div_trivial": 1375840, - "alexandria_math::tests::math_test::test_rotl_min": 1297740, - "alexandria_searching::tests::binary_search_closest_test::all_values": 1290730, - "alexandria_storage::tests::list_test::tests::test_array_get_value_after_clean": 1273650, - "alexandria_data_structures::tests::byte_reader::test_byte_array_reader_equals_array_of_bytes_reader": 1209030, - "alexandria_encoding::tests::base64_felt_test::base64encode_hello_world_test": 1191618, - "alexandria_searching::tests::bm_search_test::bm_search_test_2": 1111870, - "alexandria_encoding::tests::base64_felt_test::base64urlencode_with_plus_and_slash": 1089102, - "alexandria_encoding::tests::base64_felt_test::base64encode_with_plus_and_slash": 1089102, - "alexandria_encoding::tests::base64_felt_test::base64encode_simple_test": 1082052, - "alexandria_encoding::tests::base64_felt_test::base64encode_empty_test": 1080822, - "alexandria_merkle_tree::tests::storage_proof_test::balance_lsb_proof_test": 1068614, - "alexandria_merkle_tree::tests::storage_proof_test::total_balance_lsb_proof_test": 1040418, - "alexandria_math::tests::wad_ray_math_test::test_wad_mul_trivial": 1033210, - "alexandria_math::tests::wad_ray_math_test::test_ray_mul_trivial": 1033210, - "alexandria_data_structures::tests::byte_appender::test_append_u512_arr": 1025220, - "alexandria_storage::tests::list_test::tests::test_append_few": 1007590, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_long_string_with_payload_len_on_2_bytes": 1004560, - "alexandria_math::tests::aliquot_sum_test::three_digit_number_test": 968080, - "alexandria_math::tests::wad_ray_math_test::test_ray_mul_rounding": 937950, - "alexandria_math::tests::math_test::test_rotr_max": 914540, - "alexandria_bytes::tests::test_bytes::test_bytes_zero": 913770, - "alexandria_bytes::tests::test_bytes::test_bytes_read_bytes31": 903920, - "alexandria_data_structures::tests::byte_appender::test_append_u512_le": 903490, - "alexandria_storage::tests::list_test::tests::test_fetch_existing_list": 900760, - "alexandria_storage::tests::list_test::tests::test_is_empty": 893330, - "alexandria_math::tests::zellers_congruence_test::zellers_congruence_invalid_parameters_test": 886500, - "alexandria_math::tests::karatsuba_test::multiply_by_number_lt_ten": 874810, - "alexandria_math::tests::math_test::shl_should_not_overflow": 868516, - "alexandria_searching::tests::levenshtein_distance_test::bm_search_test_1": 852590, - "alexandria_storage::tests::list_test::tests::test_new_then_fill_list": 844060, - "alexandria_encoding::tests::reversible_test::test_reverse_bits_array": 830320, - "alexandria_sorting::tests::quick_sort_test::quicksort_test": 829340, - "alexandria_encoding::tests::reversible_test::test_reverse_bytes_u256": 775940, - "alexandria_merkle_tree::tests::storage_proof_test::wrong_contract_address_proof_test": 775102, - "alexandria_math::tests::wad_ray_math_test::test_revertWhen_wad_mul_overflow": 773610, - "alexandria_math::tests::wad_ray_math_test::test_revertWhen_ray_mul_overflow": 773610, - "alexandria_searching::tests::dijkstra_test::calculate_shortest_path": 769110, - "alexandria_data_structures::tests::byte_appender::test_append_u512_le_arr": 766260, - "alexandria_data_structures::tests::byte_reader::test_clone_byte_array_reader": 762270, - "alexandria_data_structures::tests::byte_reader::test_read_u256_le": 751990, - "alexandria_data_structures::tests::byte_reader::test_read_u256": 751990, - "alexandria_searching::tests::dijkstra_test::calculate_shortest_path_random": 751730, - "alexandria_numeric::tests::interpolate_fast_test::interp_constant_left_diff": 750720, - "alexandria_storage::tests::list_test::tests::test_append_array_empty": 747280, - "alexandria_storage::tests::list_test::tests::test_array_clean_with_empty_array": 747010, - "alexandria_bytes::tests::test_bytes_store::tests::test_bytes_storage_40_bytes": 740360, - "alexandria_ascii::tests::test_ascii_integer::u128_to_ascii": 718640, - "alexandria_sorting::tests::quick_sort_test::quicksort_test_pre_sorted_decreasing": 717900, - "alexandria_searching::tests::dijkstra_test::calculate_shortest_path_node_visited": 710210, - "alexandria_math::tests::zellers_congruence_test::zellers_congruence_test": 709180, - "alexandria_bytes::tests::test_bytes::test_bytes_read_felt252_packed": 708660, - "alexandria_math::tests::i257_test::i257_test_div_rem": 707000, - "alexandria_bytes::tests::test_bytes_store::tests::test_bytes_storage_32_bytes": 696650, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u256": 690780, - "alexandria_sorting::tests::merge_sort_test::merge_sort_test": 690020, - "alexandria_sorting::tests::quick_sort_test::quicksort_test_pre_sorted_2_same_values": 685090, - "alexandria_sorting::tests::quick_sort_test::quicksort_test_pre_sorted": 685090, - "alexandria_sorting::tests::quick_sort_test::quicksort_test_2_same_values": 677090, - "alexandria_data_structures::tests::byte_appender::test_append_i16_le_neg": 675850, - "alexandria_bytes::tests::test_bytes::test_bytes_read_address": 671520, - "alexandria_merkle_tree::tests::storage_proof_test::balance_msb_proof_test": 665518, - "alexandria_math::tests::wad_ray_math_test::test_wad_to_ray_conversion": 664010, - "alexandria_math::tests::wad_ray_math_test::test_ray_to_wad_conversion": 659700, - "alexandria_searching::tests::binary_search_closest_test::closest_value_found": 654650, - "alexandria_storage::tests::list_test::tests::test_new_initializes_empty_list": 648430, - "alexandria_data_structures::tests::byte_appender::test_append_i128_arr": 632500, - "alexandria_storage::tests::list_test::tests::test_array_empty": 627450, - "alexandria_math::tests::fast_root_test::fast_curt_test_1": 625330, - "alexandria_data_structures::tests::byte_appender::test_append_u256_arr": 622940, - "alexandria_data_structures::tests::byte_appender::test_append_u128_arr": 621740, - "alexandria_data_structures::tests::byte_appender::test_append_i128_le": 600590, - "alexandria_data_structures::tests::byte_appender::test_append_u256_le": 591230, - "alexandria_data_structures::tests::byte_appender::test_append_u128_le": 589830, - "alexandria_searching::tests::binary_search_closest_test::value_found": 583930, - "alexandria_linalg::tests::norm_test::norm_test_into": 570910, - "alexandria_linalg::tests::norm_test::norm_test_1": 570910, - "alexandria_encoding::tests::reversible_test::test_reverse_bits_u64": 559120, - "alexandria_storage::tests::list_test::tests::test_get_out_of_bounds": 555730, - "alexandria_data_structures::tests::byte_appender::test_append_i16_neg_arr": 552260, - "alexandria_math::tests::math_test::pow_test": 548670, - "alexandria_encoding::tests::reversible_test::test_reverse_bytes_bytes31": 544700, - "alexandria_data_structures::tests::byte_appender::test_append_i32_le_neg": 534570, - "alexandria_storage::tests::list_test::tests::test_get_index_out_of_bounds": 524550, - "alexandria_math::tests::mod_arithmetics_test::mult_mod_test": 520360, - "alexandria_searching::tests::binary_search_test::value_found": 512200, - "alexandria_sorting::tests::bubble_sort_test::bubble_sort_test": 510430, - "alexandria_bytes::tests::test_bytes::test_bytes_read_felt252_packed_too_large": 510140, - "alexandria_bytes::tests::test_bytes::test_bytes_read_felt252_packed_out_of_bound": 510140, - "alexandria_math::tests::mod_arithmetics_test::mult_mod_2_test": 503690, - "alexandria_math::tests::mod_arithmetics_test::mult_mod_1_test": 503690, - "alexandria_data_structures::tests::byte_appender::test_append_i128_le_arr": 503020, - "alexandria_math::tests::fast_root_test::fast_sqrt_test_2": 502430, - "alexandria_math::tests::fast_root_test::fast_sqrt_test_1": 502430, - "alexandria_data_structures::tests::byte_appender::test_append_u256_le_arr": 493460, - "alexandria_data_structures::tests::byte_appender::test_append_u128_le_arr": 492260, - "alexandria_storage::tests::list_test::tests::test_deploy": 488210, - "alexandria_encoding::tests::base64_test::base64urldecode_with_plus_and_slash": 483994, - "alexandria_encoding::tests::base64_test::base64decode_with_plus_and_slash": 483994, - "alexandria_encoding::tests::base64_test::base64decode_simple_test": 482684, - "alexandria_math::tests::wad_ray_math_test::test_wad_mul_fractions": 480770, - "alexandria_math::tests::wad_ray_math_test::test_ray_mul_fractions": 480770, - "alexandria_data_structures::tests::byte_appender::test_append_i32_neg_arr": 480100, - "alexandria_data_structures::tests::byte_reader::test_read_sequence_le_arr": 478040, - "alexandria_data_structures::tests::byte_reader::test_read_sequence_arr": 478040, - "alexandria_data_structures::tests::byte_appender::test_append_i16_le": 476810, - "alexandria_data_structures::tests::byte_reader::test_read_u512_le_arr": 465660, - "alexandria_data_structures::tests::byte_reader::test_read_u512_arr": 465660, - "alexandria_data_structures::tests::byte_appender::test_append_i16_neg": 464330, - "alexandria_data_structures::tests::byte_appender::test_append_i64_le_neg": 463930, - "alexandria_data_structures::tests::byte_appender::test_append_i64_le": 463930, - "alexandria_data_structures::tests::byte_appender::test_append_i16_le_neg_arr": 462180, - "alexandria_math::tests::mod_arithmetics_test::sqr_mod_test": 457360, - "alexandria_data_structures::tests::byte_appender::test_append_u16_le": 455490, - "alexandria_math::tests::perfect_number_test::not_perfect_small_number_test": 453560, - "alexandria_data_structures::tests::byte_appender::test_append_u64_le": 453170, - "alexandria_bytes::tests::test_bytes_store::tests::test_deploy": 451920, - "alexandria_data_structures::tests::byte_reader::test_len_arr": 450920, - "alexandria_sorting::tests::merge_sort_test::merge_sort_test_2_same_values_pre_sorted": 445190, - "alexandria_sorting::tests::merge_sort_test::merge_sort_test_2_same_values": 445190, - "alexandria_data_structures::tests::byte_appender::test_append_i64_neg_arr": 444020, - "alexandria_data_structures::tests::byte_appender::test_append_i64_arr": 444020, - "alexandria_math::tests::bitmap_test::test_bitmap_set_bit_at_10": 443716, - "alexandria_merkle_tree::tests::merkle_tree_test::regular_call_merkle_tree_pedersen::regular_call_merkle_tree_pedersen_test": 439380, - "alexandria_merkle_tree::tests::merkle_tree_test::merkle_tree_pedersen_test": 439380, - "alexandria_math::tests::wad_ray_math_test::test_wad_mul_rounding_up": 439130, - "alexandria_math::tests::wad_ray_math_test::test_ray_mul_rounding_up": 439130, - "alexandria_data_structures::tests::byte_appender::test_append_u64_arr": 433260, - "alexandria_data_structures::tests::byte_appender::test_append_i128_le_neg": 428610, - "alexandria_math::tests::bitmap_test::test_bitmap_nearest_significant_bit_right_priority_at_index": 426732, - "alexandria_math::tests::bitmap_test::test_bitmap_nearest_significant_bit_right_priority": 426732, - "alexandria_math::tests::bitmap_test::test_bitmap_nearest_significant_bit_left_priority_at_index": 426732, - "alexandria_math::tests::bitmap_test::test_bitmap_nearest_significant_bit_left_priority": 426732, - "alexandria_data_structures::tests::byte_appender::test_append_i128_neg_arr": 425980, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u128": 419170, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_short_nested_list": 416688, - "alexandria_data_structures::tests::byte_reader::test_word_u128_none": 413880, - "alexandria_data_structures::tests::byte_reader::test_word_u128_le_none": 413880, - "alexandria_data_structures::tests::byte_reader::test_word_u128_le": 413780, - "alexandria_data_structures::tests::byte_reader::test_word_u128": 413780, - "alexandria_math::tests::i257_test::i257_test_div_no_rem": 413760, - "alexandria_data_structures::tests::byte_appender::test_append_i32_le": 406170, - "alexandria_data_structures::tests::byte_appender::test_append_i32_le_neg_arr": 404500, - "alexandria_math::tests::test_keccak256::test_keccak256_full_u256": 403742, - "alexandria_bytes::tests::test_bytes::test_bytes_read_usize": 401770, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u64": 401770, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u32": 401770, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u16": 401770, - "alexandria_math::tests::is_prime_test::is_prime_test_4": 401710, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u8": 401470, - "alexandria_math::tests::mod_arithmetics_test::div_mod_test": 397220, - "alexandria_numeric::tests::interpolate_test::interp_constant_right_test": 396340, - "alexandria_data_structures::tests::byte_appender::test_append_u32_le": 395410, - "alexandria_data_structures::tests::byte_appender::test_append_u512": 394910, - "alexandria_merkle_tree::tests::merkle_tree_test::merkle_tree_poseidon_test": 389430, - "alexandria_sorting::tests::merge_sort_test::merge_sort_test_pre_sorted": 385730, - "alexandria_sorting::tests::merge_sort_test::merge_sort_test_2_pre_sorted_decreasing": 385730, - "alexandria_data_structures::tests::byte_appender::test_append_i16_arr": 385460, - "alexandria_numeric::tests::interpolate_fast_test::interp_constant_right_test": 384100, - "alexandria_searching::tests::levenshtein_distance_test::bm_search_test_5": 382270, - "alexandria_math::tests::math_test::test_wrapping_math_wrapping": 377002, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_short_nested_list": 376500, - "alexandria_data_structures::tests::byte_appender::test_append_i64_le_neg_arr": 375660, - "alexandria_data_structures::tests::byte_appender::test_append_i64_le_arr": 375660, - "alexandria_math::tests::perfect_number_test::perfect_numbers_test": 375330, - "alexandria_data_structures::tests::byte_appender::test_append_i32_neg": 371050, - "alexandria_data_structures::tests::byte_appender::test_append_i16": 371050, - "alexandria_math::tests::ed25519_test::affine_point_op": 369690, - "alexandria_data_structures::tests::byte_appender::test_append_u64_le_arr": 364900, - "alexandria_data_structures::tests::byte_appender::test_append_u16_arr": 363940, - "alexandria_data_structures::tests::byte_appender::test_append_i128_le_neg_arr": 361240, - "alexandria_numeric::tests::interpolate_fast_test::interp_nearest_test": 358780, - "alexandria_numeric::tests::interpolate_fast_test::interp_constant_left_test": 358780, - "alexandria_sorting::tests::bubble_sort_test::bubble_sort_test_pre_sorted_decreasing": 356290, - "alexandria_data_structures::tests::byte_appender::test_append_u16": 351530, - "alexandria_data_structures::tests::byte_appender::test_append_i32_arr": 349380, - "alexandria_numeric::tests::interpolate_test::interp_nearest_test": 349180, - "alexandria_numeric::tests::interpolate_test::interp_constant_left_test": 349180, - "alexandria_data_structures::tests::byte_appender::test_append_i128": 345550, - "alexandria_numeric::tests::interpolate_fast_test::interp_extrapolation_test": 343030, - "alexandria_encoding::tests::reversible_test::test_reverse_bytes_array": 340440, - "alexandria_data_structures::tests::byte_appender::test_append_i16_le_arr": 340420, - "alexandria_data_structures::tests::byte_appender::test_append_u32_arr": 338620, - "alexandria_data_structures::tests::byte_appender::test_append_u256": 335790, - "alexandria_data_structures::tests::byte_appender::test_append_u128": 335790, - "alexandria_math::tests::mod_arithmetics_test::sub_mod_test": 334890, - "alexandria_storage::tests::list_test::tests::test_pop_front_empty": 334330, - "alexandria_data_structures::tests::byte_appender::test_append_i64_neg": 324410, - "alexandria_data_structures::tests::byte_appender::test_append_i64": 324410, - "alexandria_data_structures::tests::byte_appender::test_append_i32": 324410, - "alexandria_numeric::tests::interpolate_fast_test::interp_linear_test": 323890, - "alexandria_math::tests::mod_arithmetics_test::sub_mod_2_test": 322970, - "alexandria_math::tests::mod_arithmetics_test::sub_mod_1_test": 322970, - "alexandria_math::tests::math_test::count_digits_of_base_test": 320190, - "alexandria_data_structures::tests::byte_appender::test_append_u16_le_arr": 318900, - "alexandria_data_structures::tests::byte_appender::test_append_u64": 314650, - "alexandria_data_structures::tests::byte_appender::test_append_u32": 314650, - "alexandria_math::tests::math_test::test_wrapping_math_non_wrapping": 313654, - "alexandria_encoding::tests::base64_test::base64encode_hello_world_test": 312390, - "alexandria_data_structures::tests::byte_appender::test_append_i32_le_arr": 311580, - "alexandria_searching::tests::binary_search_closest_test::length_three_span": 311130, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_short_list": 306604, - "alexandria_storage::tests::list_test::tests::test_get_empty": 306290, - "alexandria_numeric::tests::interpolate_test::interp_extrapolation_test": 303430, - "alexandria_data_structures::tests::byte_appender::test_append_i128_neg": 301090, - "alexandria_data_structures::tests::byte_appender::test_append_u32_le_arr": 300820, - "alexandria_numeric::tests::interpolate_test::interp_linear_test": 300610, - "alexandria_math::tests::i257_test::i257_test_sub": 298810, - "alexandria_sorting::tests::bubble_sort_test::bubble_sort_test_2_same_values": 297650, - "alexandria_encoding::tests::reversible_test::test_reverse_bits_u32": 297360, - "alexandria_data_structures::tests::array_ext::concat::of_u128": 296590, - "alexandria_ascii::tests::test_ascii_integer::u64_to_ascii": 294290, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_long_string_with_payload_len_on_1_byte": 293990, - "alexandria_searching::tests::dijkstra_test::add_edge": 291960, - "alexandria_searching::tests::binary_search_closest_test::value_not_found": 291120, - "alexandria_math::tests::collatz_sequence_test::collatz_sequence_15_test": 289270, - "alexandria_math::tests::test_keccak256::test_keccak256_partial_bytes": 285232, - "alexandria_storage::tests::list_test::tests::test_fetch_empty_list": 275520, - "alexandria_encoding::tests::reversible_test::test_reverse_bytes_u128": 272900, - "alexandria_storage::tests::list_test::tests::test_set_out_of_bounds": 271420, - "alexandria_data_structures::tests::array_ext::extend_from_span::of_u128": 271100, - "alexandria_data_structures::tests::byte_appender::test_append_i8_neg": 268960, - "alexandria_data_structures::tests::byte_appender::test_append_i8": 268960, - "alexandria_sorting::tests::bubble_sort_test::bubble_sort_test_pre_sorted_2_same_values": 268330, - "alexandria_sorting::tests::bubble_sort_test::bubble_sort_test_pre_sorted": 268330, - "alexandria_math::tests::test_keccak256::test_keccak256_empty_bytes": 265972, - "alexandria_data_structures::tests::byte_array_ext::test_span_u8_into_byte_array": 264000, - "alexandria_data_structures::tests::array_ext::concat::of_felt": 263700, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u128_array_packed_too_large": 261880, - "alexandria_data_structures::tests::array_ext::reversed::of_u128": 260230, - "alexandria_searching::tests::binary_search_test::value_not_found": 258140, - "alexandria_math::tests::wad_ray_math_test::test_wad_div_fractions": 257850, - "alexandria_math::tests::wad_ray_math_test::test_ray_div_fractions": 257850, - "alexandria_data_structures::tests::byte_reader::test_reader_helper_arr": 257760, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_multi_list": 257000, - "alexandria_data_structures::tests::byte_reader::test_clone_array_of_bytes_reader": 256900, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u128_packed_too_large": 252960, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u128_packed_out_of_bound": 252960, - "alexandria_data_structures::tests::byte_reader::test_read_u256_le_arr": 251380, - "alexandria_data_structures::tests::byte_reader::test_read_u256_arr": 251380, - "alexandria_data_structures::tests::array_ext::unique::without_duplicates": 248580, - "alexandria_data_structures::tests::array_ext::dedup::one_match_more": 241630, - "alexandria_data_structures::tests::array_ext::reversed::of_felt": 241380, - "alexandria_ascii::tests::test_ascii_integer::u32_to_ascii": 239390, - "alexandria_data_structures::tests::array_ext::dedup::two_matches": 238560, - "alexandria_math::tests::lcm_of_n_numbers_test::lcm_test": 237850, - "alexandria_math::tests::i257_test::i257_test_mul": 236640, - "alexandria_data_structures::tests::array_ext::dedup::one_match": 235490, - "alexandria_sorting::tests::merge_sort_test::merge_sort_test_one_element": 235310, - "alexandria_data_structures::tests::array_ext::extend_from_span::of_felt": 234660, - "alexandria_data_structures::tests::array_ext::extend_from_span::from_self": 233960, - "alexandria_searching::tests::levenshtein_distance_test::bm_search_test_4": 233060, - "alexandria_data_structures::tests::array_ext::occurrences::of_u128": 232850, - "alexandria_data_structures::tests::array_ext::occurrences::of_felt": 232850, - "alexandria_math::tests::bitmap_test::test_bitmap_get_bit_at_10": 231768, - "alexandria_sorting::tests::merge_sort_test::merge_sort_test_empty": 231540, - "alexandria_data_structures::tests::array_ext::dedup::all_different": 231520, - "alexandria_data_structures::tests::byte_appender::test_append_i8_neg_arr": 231010, - "alexandria_data_structures::tests::byte_appender::test_append_i8_arr": 231010, - "alexandria_math::tests::lcm_of_n_numbers_test::lcm_test_inverse": 229600, - "alexandria_math::tests::bitmap_test::test_bitmap_nearest_left_significant_bit": 228768, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_short_list": 227900, - "alexandria_data_structures::tests::array_ext::concat::empty_array_2": 227890, - "alexandria_sorting::tests::bubble_sort_test::bubble_sort_test_one_element": 227700, - "alexandria_data_structures::tests::array_ext::concat::empty_array_1": 227690, - "alexandria_data_structures::tests::byte_reader::test_word_u64_none": 227290, - "alexandria_data_structures::tests::byte_reader::test_word_u64_le_none": 227290, - "alexandria_math::tests::gcd_of_n_numbers_test::gcd_test": 227240, - "alexandria_data_structures::tests::byte_reader::test_word_u64_le": 227190, - "alexandria_data_structures::tests::byte_reader::test_word_u64": 227190, - "alexandria_math::tests::lcm_of_n_numbers_test::lcm_test_tryinto": 224900, - "alexandria_math::tests::gcd_of_n_numbers_test::gcd_test_inverse": 224490, - "alexandria_sorting::tests::bubble_sort_test::bubble_sort_test_empty": 223930, - "alexandria_encoding::tests::base64_test::base64urlencode_with_plus_and_slash": 223458, - "alexandria_encoding::tests::base64_test::base64encode_with_plus_and_slash": 223458, - "alexandria_encoding::tests::base64_test::base64encode_simple_test": 223258, - "alexandria_math::tests::mod_arithmetics_test::add_mod_p_test": 222160, - "alexandria_linalg::tests::kron_test::kron_product_test": 219180, - "alexandria_data_structures::tests::array_ext::reversed::even": 218150, - "alexandria_math::tests::lcm_of_n_numbers_test::lcm_test_4": 217600, - "alexandria_math::tests::lcm_of_n_numbers_test::lcm_test_3": 217600, - "alexandria_data_structures::tests::array_ext::extend_from_span::empty_span": 216840, - "alexandria_data_structures::tests::array_ext::unique::duplicate_back": 216610, - "alexandria_math::tests::bitmap_test::test_bitmap_nearest_right_significant_bit": 215654, - "alexandria_math::tests::gcd_of_n_numbers_test::gcd_test_3": 214550, - "alexandria_math::tests::i257_test::i257_test_add": 214310, - "alexandria_data_structures::tests::array_ext::dedup::one_elem": 212500, - "alexandria_data_structures::tests::array_ext::unique::duplicate_middle": 212070, - "alexandria_ascii::tests::test_ascii_integer::u16_to_ascii": 211940, - "alexandria_numeric::tests::trapezoidal_rule_test::trapezoidal_rule_test": 211350, - "alexandria_data_structures::tests::array_ext::dedup::no_elem": 206260, - "alexandria_math::tests::collatz_sequence_test::collatz_sequence_10_test": 205120, - "alexandria_data_structures::tests::array_ext::extend_from_span::empty_array": 205080, - "alexandria_searching::tests::binary_search_closest_test::length_two_span": 204410, - "alexandria_data_structures::tests::array_ext::unique::duplicate_front": 202990, - "alexandria_math::tests::wad_ray_math_test::test_wad_mul_rounding": 201880, - "alexandria_linalg::tests::norm_test::norm_test_2": 201340, - "alexandria_ascii::tests::test_ascii_integer::u8_to_ascii": 200960, - "alexandria_data_structures::tests::array_ext::unique::one_duplicate": 197650, - "alexandria_data_structures::tests::array_ext::append_all::source_empty": 196390, - "alexandria_data_structures::tests::array_ext::append_all::destination_empty": 196390, - "alexandria_data_structures::tests::array_ext::min_position::of_u128": 194820, - "alexandria_data_structures::tests::array_ext::max_position::max_position": 194820, - "alexandria_data_structures::tests::array_ext::append_all::of_felt": 194260, - "alexandria_numeric::tests::diff_test::diff_test": 193190, - "alexandria_math::tests::fibonacci_test::fibonacci_test": 192620, - "alexandria_math::tests::aliquot_sum_test::two_digit_prime_number_test": 192200, - "alexandria_data_structures::tests::span_ext::pop_back_n::of_felt": 190570, - "alexandria_data_structures::tests::span_ext::pop_back_n::pop_zero": 190170, - "alexandria_data_structures::tests::array_ext::remove_front_n::remove_zero": 190050, - "alexandria_data_structures::tests::array_ext::reversed::size_1": 189430, - "alexandria_data_structures::tests::span_ext::pop_front_n::pop_zero": 188960, - "alexandria_data_structures::tests::array_ext::dedup::multiple_duplicates_same": 188400, - "alexandria_data_structures::tests::span_ext::remove_back_n::remove_zero": 187790, - "alexandria_data_structures::tests::span_ext::remove_front_n::remove_zero": 187660, - "alexandria_math::tests::aliquot_sum_test::two_digit_number_test": 187440, - "alexandria_data_structures::tests::array_ext::position::of_u128": 187130, - "alexandria_data_structures::tests::span_ext::remove_back_n::of_felt": 185370, - "alexandria_math::tests::i257_test::i257_test_div_sign_zero": 184730, - "alexandria_math::tests::mod_arithmetics_test::add_mod_1_test": 180960, - "alexandria_math::tests::perfect_number_test::perfect_small_number_test": 180840, - "alexandria_data_structures::tests::array_ext::append_all::of_u128": 180020, - "alexandria_searching::tests::binary_search_test::value_found_length_one": 178860, - "alexandria_linalg::tests::norm_test::norm_test_3": 176760, - "alexandria_math::tests::gcd_of_n_numbers_test::gcd_single_test": 176480, - "alexandria_numeric::tests::cumsum_test::cumsum_test": 173780, - "alexandria_numeric::tests::cumprod_test::cumprod_test": 173580, - "alexandria_data_structures::tests::span_ext::pop_back_n::of_u128": 173270, - "alexandria_searching::tests::levenshtein_distance_test::bm_search_test_3": 173030, - "alexandria_math::tests::is_power_of_two_test::is_power_of_two_test_5": 171364, - "alexandria_encoding::tests::base64_test::base64encode_empty_test": 170950, - "alexandria_data_structures::tests::span_ext::remove_back_n::of_u128": 170930, - "alexandria_math::tests::mod_arithmetics_test::add_mod_2_test": 170660, - "alexandria_linalg::tests::dot_test::dot_product_test": 170510, - "alexandria_math::tests::bitmap_test::test_bitmap_set_bit_at_1": 170416, - "alexandria_math::tests::bitmap_test::test_bitmap_set_bit_at_0": 170416, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_short_string": 169460, - "alexandria_searching::tests::levenshtein_distance_test::bm_search_test_2": 169420, - "alexandria_data_structures::tests::array_ext::position::of_felt": 169260, - "alexandria_math::tests::aliquot_sum_test::one_digit_number_test": 168400, - "alexandria_numeric::tests::integers_test::test_u32_from_bytes": 168230, - "alexandria_encoding::tests::reversible_test::test_reverse_bits_u16": 166480, - "alexandria_data_structures::tests::queue::queue_peek_front_test": 164990, - "alexandria_numeric::tests::integers_test::test_u32_to_bytes_full": 164886, - "alexandria_numeric::tests::integers_test::test_u32_to_bytes_partial": 163576, - "alexandria_data_structures::tests::array_ext::dedup::all_same": 163530, - "alexandria_data_structures::tests::array_ext::unique::all_same": 162610, - "alexandria_math::tests::lcm_of_n_numbers_test::lcm_single_test": 162350, - "alexandria_numeric::tests::integers_test::test_u32_to_bytes_leading_zeros": 162266, - "alexandria_data_structures::tests::array_ext::pop_front_n::of_felt": 162030, - "alexandria_encoding::tests::base64_test::base64decode_empty_test": 160270, - "alexandria_math::tests::aliquot_sum_test::two_test": 158880, - "alexandria_data_structures::tests::array_ext::min::of_u128": 158500, - "alexandria_data_structures::tests::array_ext::min::of_felt": 158500, - "alexandria_data_structures::tests::array_ext::max::max": 158060, - "alexandria_math::tests::fast_root_test::fast_nr_optimize_test_2": 157440, - "alexandria_data_structures::tests::array_ext::remove_front_n::of_felt": 157170, - "alexandria_math::tests::i257_test::i257_test_into": 156040, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_mutilple_string": 155682, - "alexandria_math::tests::i257_test::i257_test_partial_ord": 155380, - "alexandria_data_structures::tests::span_ext::pop_front_n::of_felt": 154430, - "alexandria_data_structures::tests::array_ext::pop_front_n::pop_zero": 154340, - "alexandria_math::tests::aliquot_sum_test::zero_test": 154120, - "alexandria_math::tests::aliquot_sum_test::one_test": 154120, - "alexandria_math::tests::collatz_sequence_test::collatz_sequence_empty_test": 151570, - "alexandria_data_structures::tests::byte_reader::test_word_u32_none": 151170, - "alexandria_data_structures::tests::byte_reader::test_word_u32_le_none": 151170, - "alexandria_data_structures::tests::byte_reader::test_word_u32_le": 151070, - "alexandria_data_structures::tests::byte_reader::test_word_u32": 151070, - "alexandria_data_structures::tests::queue::queue_dequeue_test": 150480, - "alexandria_data_structures::tests::queue::queue_enqueue_test": 150240, - "alexandria_data_structures::tests::span_ext::remove_front_n::of_felt": 149500, - "alexandria_data_structures::tests::queue::queue_new_test": 148600, - "alexandria_data_structures::tests::array_ext::pop_front_n::exact_len": 146900, - "alexandria_searching::tests::binary_search_closest_test::value_found_length_one": 145770, - "alexandria_data_structures::tests::array_ext::pop_front_n::of_u128": 144730, - "alexandria_data_structures::tests::byte_reader::test_word_u128_le_none_arr": 143670, - "alexandria_data_structures::tests::byte_reader::test_word_u128_le_arr": 143570, - "alexandria_data_structures::tests::byte_reader::test_word_u128_arr": 143570, - "alexandria_data_structures::tests::array_ext::remove_front_n::of_u128": 142730, - "alexandria_math::tests::armstrong_number_test::three_digit_armstrong_number_test": 142460, - "alexandria_data_structures::tests::array_ext::max_position::max_position_one_item": 139120, - "alexandria_data_structures::tests::array_ext::min_position::min_position_one_item": 138680, - "alexandria_data_structures::tests::array_ext::min::one_item": 137290, - "alexandria_data_structures::tests::span_ext::pop_front_n::of_u128": 137130, - "alexandria_data_structures::tests::array_ext::max::max_one_item": 136850, - "alexandria_data_structures::tests::span_ext::pop_back_n::exact_len": 136560, - "alexandria_data_structures::tests::span_ext::pop_front_n::exact_len": 136160, - "alexandria_data_structures::tests::array_ext::occurrences::empty_array": 136140, - "alexandria_data_structures::tests::array_ext::append_all::both_empty": 135810, - "alexandria_data_structures::tests::array_ext::reversed::empty": 135470, - "alexandria_data_structures::tests::span_ext::remove_front_n::of_u128": 135060, - "alexandria_data_structures::tests::byte_reader::test_word_u16_none": 113110, - "alexandria_data_structures::tests::byte_reader::test_word_u16_le_none": 113110, - "alexandria_data_structures::tests::byte_reader::test_word_u16_le": 113010, - "alexandria_data_structures::tests::byte_reader::test_word_u16": 113010, - "alexandria_data_structures::tests::bit_array::test_index": 106660, - "alexandria_data_structures::tests::bit_array::test_len": 103980, - "alexandria_math::tests::bitmap_test::test_bitmap_least_significant_bit": 101284, - "alexandria_encoding::tests::reversible_test::test_reverse_bytes_u64": 101040, - "alexandria_encoding::tests::reversible_test::test_reverse_bits_u8": 101040, - "alexandria_math::tests::bitmap_test::test_bitmap_get_bit_at_0": 95118, - "alexandria_math::tests::bitmap_test::test_bitmap_get_bit_at_1": 94618, - "alexandria_data_structures::tests::byte_reader::test_reader_helper": 91630, - "alexandria_math::tests::bitmap_test::test_bitmap_most_significant_bit": 87870, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_string_length_between_2_and_55": 82156, - "alexandria_data_structures::tests::stack::nullable_stack_push_pop_push_test": 78450, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_string_single_byte_ge_0x80": 76106, - "alexandria_sorting::tests::quick_sort_test::quicksort_test_one_element": 75920, - "alexandria_math::tests::trigonometry_test::tan_positive_test_1": 74780, - "alexandria_math::tests::trigonometry_test::tan_negative_test_1": 74780, - "alexandria_data_structures::tests::array_ext::contains::of_u128": 73010, - "alexandria_data_structures::tests::array_ext::contains::of_felt": 73010, - "alexandria_math::tests::armstrong_number_test::three_digit_non_armstrong_number_test": 71780, - "alexandria_data_structures::tests::byte_reader::test_word_u64_none_arr": 71560, - "alexandria_data_structures::tests::byte_reader::test_word_u64_le_none_arr": 71560, - "alexandria_data_structures::tests::byte_reader::test_word_u64_le_arr": 71460, - "alexandria_data_structures::tests::byte_reader::test_word_u64_arr": 71460, - "alexandria_math::tests::armstrong_number_test::two_digit_numbers_are_not_armstrong_numbers_test": 68460, - "alexandria_data_structures::tests::bit_array::test_pop_front": 68370, - "alexandria_encoding::tests::reversible_test::test_reverse_bytes_u32": 68320, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_string_single_byte_lt_0x80": 67986, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_default_value": 67786, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_long_string_with_input_too_short": 67160, - "alexandria_data_structures::tests::bit_array::test_at_none": 66470, - "alexandria_data_structures::tests::stack::nullable_stack_pop_test": 64650, - "alexandria_data_structures::tests::stack::nullable_stack_peek_test": 64650, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_long_list_with_input_too_short": 63770, - "alexandria_sorting::tests::quick_sort_test::quicksort_test_empty": 63520, - "alexandria_data_structures::tests::bit_array::test_pop_front_empty": 62690, - "alexandria_encoding::tests::rlp_test::test_rlp_encode_empty_input_should_fail": 61676, - "alexandria_math::tests::i257_test::i257_test_equality": 60340, - "alexandria_data_structures::tests::stack::felt252_stack_push_pop_push_test": 60030, - "alexandria_math::tests::armstrong_number_test::one_digit_armstrong_number_test": 59890, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_string_default_value": 59160, - "alexandria_data_structures::tests::vec::nullable_vec_index_trait_test": 58550, - "alexandria_data_structures::tests::vec::felt252_vec_index_trait_test": 57910, - "alexandria_data_structures::tests::vec::nullable_vec_get_test": 56990, - "alexandria_data_structures::tests::vec::felt252_vec_get_test": 56250, - "alexandria_data_structures::tests::array_ext::pop_front_n::more_then_len": 56140, - "alexandria_data_structures::tests::stack::felt252_stack_pop_test": 55240, - "alexandria_data_structures::tests::stack::felt252_stack_peek_test": 55240, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_short_string_input_too_short": 54540, - "alexandria_data_structures::tests::array_ext::remove_front_n::more_then_len": 53640, - "alexandria_data_structures::tests::array_ext::remove_front_n::exact_len": 53640, - "alexandria_data_structures::tests::stack::nullable_stack_push_test": 53530, - "alexandria_data_structures::tests::stack::felt252_stack_push_test": 52930, - "alexandria_data_structures::tests::byte_reader::test_word_u32_none_arr": 52680, - "alexandria_data_structures::tests::byte_reader::test_word_u32_le_none_arr": 52680, - "alexandria_data_structures::tests::byte_reader::test_word_u32_le_arr": 52580, - "alexandria_data_structures::tests::byte_reader::test_word_u32_arr": 52580, - "alexandria_data_structures::tests::vec::nullable_vec_set_test": 51990, - "alexandria_encoding::tests::reversible_test::test_reverse_bytes_u16": 51960, - "alexandria_data_structures::tests::vec::felt252_vec_set_test": 51470, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_short_list_with_input_too_short": 50940, - "alexandria_data_structures::tests::array_ext::concat::both_empty": 49990, - "alexandria_math::tests::trigonometry_test::sin_positive_test_3": 49810, - "alexandria_math::tests::trigonometry_test::sin_positive_test_2": 49810, - "alexandria_math::tests::trigonometry_test::sin_positive_test_1": 49810, - "alexandria_math::tests::trigonometry_test::sin_negative_test_2": 49810, - "alexandria_math::tests::trigonometry_test::sin_negative_test_1": 49810, - "alexandria_math::tests::trigonometry_test::cos_positive_test_1": 49680, - "alexandria_math::tests::trigonometry_test::cos_negative_test_1": 49680, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_long_string_with_payload_len_too_short": 49540, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_long_list_with_len_too_short": 49540, - "alexandria_data_structures::tests::vec::nullable_vec_push_test": 49280, - "alexandria_encoding::tests::rlp_test::test_rlp_empty": 49140, - "alexandria_data_structures::tests::vec::felt252_vec_push_test": 48960, - "alexandria_data_structures::tests::vec::nullable_vec_at_test": 48930, - "alexandria_data_structures::tests::vec::felt252_vec_at_test": 48610, - "alexandria_data_structures::tests::array_ext::unique::empty": 48050, - "alexandria_math::tests::i257_test::i257_test_eq_not_eq": 47860, - "alexandria_data_structures::tests::array_ext::pop_front_n::empty_array": 46460, - "alexandria_data_structures::tests::vec::nullable_vec_len_test": 46450, - "alexandria_data_structures::tests::vec::felt252_vec_len_test": 46350, - "alexandria_data_structures::tests::span_ext::pop_back_n::more_then_len": 45800, - "alexandria_data_structures::tests::array_ext::position::empty_array": 45620, - "alexandria_data_structures::tests::array_ext::max::max_empty_array": 45620, - "alexandria_data_structures::tests::span_ext::pop_back_n::empty_array": 45540, - "alexandria_data_structures::tests::bit_array::test_index_fail": 45430, - "alexandria_data_structures::tests::span_ext::pop_front_n::more_then_len": 45400, - "alexandria_data_structures::tests::span_ext::pop_front_n::empty_array": 45140, - "alexandria_data_structures::tests::array_ext::remove_front_n::empty_array": 45120, - "alexandria_data_structures::tests::array_ext::contains::empty_array": 44850, - "alexandria_data_structures::tests::array_ext::min_position::min_position_empty_array": 44080, - "alexandria_data_structures::tests::array_ext::max_position::max_position_empty_array": 44080, - "alexandria_data_structures::tests::array_ext::min::empty": 43680, - "alexandria_data_structures::tests::array_ext::max::empty": 43680, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_type_long_string": 43630, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_type_long_list": 43630, - "alexandria_data_structures::tests::span_ext::remove_back_n::more_then_len": 43460, - "alexandria_data_structures::tests::span_ext::remove_back_n::exact_len": 43460, - "alexandria_data_structures::tests::span_ext::remove_front_n::more_then_len": 43330, - "alexandria_data_structures::tests::span_ext::remove_front_n::exact_len": 43330, - "alexandria_data_structures::tests::byte_reader::test_word_u16_none_arr": 43240, - "alexandria_data_structures::tests::byte_reader::test_word_u16_le_none_arr": 43240, - "alexandria_data_structures::tests::byte_reader::test_word_u16_le_arr": 43140, - "alexandria_data_structures::tests::byte_reader::test_word_u16_arr": 43140, - "alexandria_data_structures::tests::span_ext::remove_back_n::empty_array": 42660, - "alexandria_data_structures::tests::bit_array::test_serde_serialize": 42590, - "alexandria_data_structures::tests::span_ext::remove_front_n::empty_array": 42530, - "alexandria_numeric::tests::interpolate_fast_test::interp_revert_len_too_short": 40190, - "alexandria_numeric::tests::interpolate_fast_test::interp_revert_len_mismatch": 38120, - "alexandria_math::tests::is_prime_test::is_prime_test_3": 37970, - "alexandria_math::tests::is_prime_test::is_prime_test_2": 37970, - "alexandria_math::tests::is_prime_test::is_prime_test_1": 37770, - "alexandria_searching::tests::binary_search_closest_test::value_not_found_length_one": 37380, - "alexandria_searching::tests::binary_search_closest_test::zero_length_span": 37180, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_type_long_string_payload_too_long": 35560, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_type_long_list_payload_too_long": 34960, - "alexandria_searching::tests::binary_search_test::value_not_found_length_one": 34730, - "alexandria_searching::tests::binary_search_test::zero_length_span": 34530, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_type_short_string": 34200, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_type_short_list": 34200, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_type_byte": 34200, - "alexandria_encoding::tests::rlp_test::test_rlp_decode_type_long_list_len_too_short": 34160, - "alexandria_data_structures::tests::vec::nullable_vec_new_test": 32650, - "alexandria_data_structures::tests::vec::felt252_vec_new_test": 32650, - "alexandria_data_structures::tests::stack::nullable_stack_new_test": 32650, - "alexandria_data_structures::tests::stack::nullable_stack_is_empty_test": 32650, - "alexandria_data_structures::tests::stack::felt252_stack_new_test": 32650, - "alexandria_data_structures::tests::stack::felt252_stack_is_empty_test": 32650, - "alexandria_math::tests::wad_ray_math_test::test_revertWhen_wad_div_zero": 31620, - "alexandria_math::tests::wad_ray_math_test::test_revertWhen_ray_div_zero": 31620, - "alexandria_numeric::tests::interpolate_test::interp_revert_len_too_short": 30290, - "alexandria_math::tests::u512_arithmetics_test::test_u512_sub": 29100, - "alexandria_numeric::tests::interpolate_test::interp_revert_len_mismatch": 28220, - "alexandria_math::tests::lcm_of_n_numbers_test::lcm_empty_input_test": 27440, - "alexandria_numeric::tests::integers_test::test_u32_from_bytes_too_big": 26980, - "alexandria_math::tests::gcd_of_n_numbers_test::gcd_empty_input_test": 26410, - "alexandria_data_structures::tests::vec::nullable_vec_set_test_expect_error": 25680, - "alexandria_data_structures::tests::vec::felt252_vec_set_test_expect_error": 25580, - "alexandria_math::tests::is_power_of_two_test::is_power_of_two_test_3": 25504, - "alexandria_data_structures::tests::vec::nullable_vec_index_trait_out_of_bounds_test": 25330, - "alexandria_data_structures::tests::vec::nullable_vec_at_out_of_bounds_test": 25230, - "alexandria_math::tests::is_power_of_two_test::is_power_of_two_test_4": 24904, - "alexandria_math::tests::is_power_of_two_test::is_power_of_two_test_2": 24904, - "alexandria_math::tests::is_power_of_two_test::is_power_of_two_test_1": 24904, - "alexandria_math::tests::i257_test::i257_test_is_zero": 23940, - "alexandria_encoding::tests::reversible_test::test_reverse_bytes_u8": 22880, - "alexandria_data_structures::tests::queue::queue_is_empty_test": 22540, - "alexandria_math::tests::u512_arithmetics_test::test_u512_add": 19600, - "alexandria_data_structures::tests::vec::felt252_vec_index_trait_out_of_bounds_test": 16020, - "alexandria_data_structures::tests::vec::felt252_vec_at_out_of_bounds_test": 16020, - "alexandria_numeric::tests::trapezoidal_rule_test::trapezoidal_rule_test_revert_not_sorted": 15670, - "alexandria_numeric::tests::diff_test::diff_test_revert_not_sorted": 9650, - "alexandria_numeric::tests::trapezoidal_rule_test::trapezoidal_rule_test_revert_len_too_short": 9450, - "alexandria_numeric::tests::trapezoidal_rule_test::trapezoidal_rule_test_revert_len_mismatch": 9250, - "alexandria_linalg::tests::kron_test::kron_product_test_check_len": 9060, - "alexandria_bytes::tests::test_bytes::test_bytes_read_u128_array_packed_out_of_bound": 7380, - "alexandria_numeric::tests::diff_test::diff_test_revert_empty": 6140, - "alexandria_numeric::tests::cumsum_test::cumsum_test_revert_empty": 6140, - "alexandria_numeric::tests::cumprod_test::cumprod_test_revert_empty": 6140, - "alexandria_linalg::tests::dot_test::dot_product_test_check_len": 4570 + "alexandria_math::tests::ed25519_test::verify_signature_test_3": 29814, + "alexandria_math::tests::ed25519_test::verify_signature_test_0": 28077, + "alexandria_math::tests::ed25519_test::verify_signature_invalid": 27943, + "alexandria_math::tests::ed25519_test::verify_signature_test_2": 27251, + "alexandria_math::tests::ed25519_test::verify_signature_test_1": 27207, + "alexandria_math::tests::sha256_test::sha256_lorem_ipsum_test": 2618, + "alexandria_math::tests::mod_arithmetics_test::pow_mod_test": 2355, + "alexandria_math::tests::mod_arithmetics_test::pow_mod_2_test": 2355, + "alexandria_math::tests::mod_arithmetics_test::pow_mod_1_test": 2355, + "alexandria_math::tests::sha256_test::sha256_url": 1749, + "alexandria_math::tests::sha512_test::test_sha512_lorem_ipsum": 1696, + "alexandria_math::tests::sha512_test::test_size_zero": 589, + "alexandria_math::tests::sha512_test::test_sha512_size_one": 589, + "alexandria_math::tests::math_test::test_pow_power_2_all": 584, + "alexandria_math::tests::sha256_test::sha256_empty_test": 458, + "alexandria_math::tests::sha256_test::sha256_random_data_test": 454, + "alexandria_math::tests::fast_power_test::fast_power_mod_test": 155, + "alexandria_math::tests::perfect_number_test::perfect_big_number_test": 139, + "alexandria_math::tests::perfect_number_test::not_perfect_big_number_test": 139, + "alexandria_math::tests::math_test::test_rotr_min": 116, + "alexandria_math::tests::fast_power_test::fast_power_test": 93, + "alexandria_math::tests::math_test::test_rotl_max": 79, + "alexandria_math::tests::fast_root_test::fast_nr_optimize_test_1": 76, + "alexandria_math::tests::karatsuba_test::multiply_distinct_size_positive_number": 72, + "alexandria_math::tests::math_test::test_rotl_min": 68, + "alexandria_math::tests::wad_ray_math_test::test_wad_div_trivial": 60, + "alexandria_math::tests::wad_ray_math_test::test_ray_div_trivial": 60, + "alexandria_math::tests::aliquot_sum_test::three_digit_number_test": 49, + "alexandria_math::tests::wad_ray_math_test::test_wad_mul_trivial": 44, + "alexandria_math::tests::wad_ray_math_test::test_ray_mul_trivial": 44, + "alexandria_math::tests::extended_euclidean_algorithm_test::extended_euclidean_algorithm_test": 44, + "alexandria_math::tests::math_test::test_rotr_max": 42, + "alexandria_math::tests::wad_ray_math_test::test_ray_mul_rounding": 41, + "alexandria_math::tests::math_test::shl_should_not_overflow": 40, + "alexandria_math::tests::wad_ray_math_test::test_revertWhen_wad_mul_overflow": 36, + "alexandria_math::tests::wad_ray_math_test::test_revertWhen_ray_mul_overflow": 36, + "alexandria_math::tests::ed25519_test::affine_point_op": 36, + "alexandria_math::tests::mod_arithmetics_test::mult_mod_test": 33, + "alexandria_math::tests::mod_arithmetics_test::mult_mod_2_test": 33, + "alexandria_math::tests::mod_arithmetics_test::mult_mod_1_test": 33, + "alexandria_math::tests::wad_ray_math_test::test_wad_to_ray_conversion": 27, + "alexandria_math::tests::wad_ray_math_test::test_ray_to_wad_conversion": 27, + "alexandria_math::tests::i257_test::i257_test_div_rem": 26, + "alexandria_math::tests::perfect_number_test::not_perfect_small_number_test": 25, + "alexandria_math::tests::mod_arithmetics_test::div_mod_test": 23, + "alexandria_math::tests::bitmap_test::test_bitmap_set_bit_at_10": 23, + "alexandria_math::tests::fast_root_test::fast_curt_test_1": 22, + "alexandria_math::tests::wad_ray_math_test::test_ray_mul_fractions": 20, + "alexandria_math::tests::mod_arithmetics_test::sqr_mod_test": 20, + "alexandria_math::tests::wad_ray_math_test::test_wad_mul_fractions": 19, + "alexandria_math::tests::karatsuba_test::multiply_by_number_lt_ten": 19, + "alexandria_math::tests::wad_ray_math_test::test_ray_mul_rounding_up": 18, + "alexandria_math::tests::math_test::pow_test": 17, + "alexandria_math::tests::is_prime_test::is_prime_test_4": 17, + "alexandria_math::tests::bitmap_test::test_bitmap_nearest_significant_bit_right_priority_at_index": 17, + "alexandria_math::tests::bitmap_test::test_bitmap_nearest_significant_bit_left_priority_at_index": 17, + "alexandria_math::tests::fast_root_test::fast_sqrt_test_2": 16, + "alexandria_math::tests::bitmap_test::test_bitmap_nearest_significant_bit_right_priority": 16, + "alexandria_math::tests::wad_ray_math_test::test_wad_mul_rounding_up": 15, + "alexandria_math::tests::fast_root_test::fast_sqrt_test_1": 15, + "alexandria_math::tests::bitmap_test::test_bitmap_nearest_significant_bit_left_priority": 15, + "alexandria_math::tests::bitmap_test::test_bitmap_get_bit_at_10": 12, + "alexandria_math::tests::zellers_congruence_test::zellers_congruence_test": 11, + "alexandria_math::tests::mod_arithmetics_test::sub_mod_test": 11, + "alexandria_math::tests::mod_arithmetics_test::sub_mod_2_test": 11, + "alexandria_math::tests::mod_arithmetics_test::sub_mod_1_test": 11, + "alexandria_math::tests::perfect_number_test::perfect_numbers_test": 10, + "alexandria_math::tests::wad_ray_math_test::test_wad_div_fractions": 9, + "alexandria_math::tests::wad_ray_math_test::test_ray_div_fractions": 9, + "alexandria_math::tests::test_keccak256::test_keccak256_full_u256": 9, + "alexandria_math::tests::perfect_number_test::perfect_small_number_test": 9, + "alexandria_math::tests::math_test::count_digits_of_base_test": 8, + "alexandria_math::tests::collatz_sequence_test::collatz_sequence_15_test": 8, + "alexandria_math::tests::bitmap_test::test_bitmap_nearest_right_significant_bit": 8, + "alexandria_math::tests::bitmap_test::test_bitmap_nearest_left_significant_bit": 8, + "alexandria_math::tests::math_test::test_wrapping_math_non_wrapping": 7, + "alexandria_math::tests::test_keccak256::test_keccak256_partial_bytes": 6, + "alexandria_math::tests::test_keccak256::test_keccak256_empty_bytes": 6, + "alexandria_math::tests::bitmap_test::test_bitmap_set_bit_at_1": 6, + "alexandria_math::tests::armstrong_number_test::three_digit_armstrong_number_test": 6, + "alexandria_math::tests::mod_arithmetics_test::add_mod_p_test": 5, + "alexandria_math::tests::lcm_of_n_numbers_test::lcm_test": 5, + "alexandria_math::tests::i257_test::i257_test_mul": 5, + "alexandria_math::tests::i257_test::i257_test_div_no_rem": 5, + "alexandria_math::tests::wad_ray_math_test::test_wad_mul_rounding": 4, + "alexandria_math::tests::trigonometry_test::tan_positive_test_1": 4, + "alexandria_math::tests::trigonometry_test::tan_negative_test_1": 4, + "alexandria_math::tests::math_test::test_wrapping_math_wrapping": 4, + "alexandria_math::tests::lcm_of_n_numbers_test::lcm_test_tryinto": 4, + "alexandria_math::tests::lcm_of_n_numbers_test::lcm_test_inverse": 4, + "alexandria_math::tests::lcm_of_n_numbers_test::lcm_test_4": 4, + "alexandria_math::tests::lcm_of_n_numbers_test::lcm_test_3": 4, + "alexandria_math::tests::i257_test::i257_test_sub": 4, + "alexandria_math::tests::i257_test::i257_test_partial_ord": 4, + "alexandria_math::tests::zellers_congruence_test::zellers_congruence_invalid_parameters_test": 3, + "alexandria_math::tests::gcd_of_n_numbers_test::gcd_test": 3, + "alexandria_math::tests::collatz_sequence_test::collatz_sequence_10_test": 3, + "alexandria_math::tests::bitmap_test::test_bitmap_set_bit_at_0": 3, + "alexandria_math::tests::bitmap_test::test_bitmap_least_significant_bit": 3, + "alexandria_math::tests::bitmap_test::test_bitmap_get_bit_at_1": 3, + "alexandria_math::tests::armstrong_number_test::three_digit_non_armstrong_number_test": 3, + "alexandria_math::tests::aliquot_sum_test::two_digit_prime_number_test": 3, + "alexandria_math::tests::aliquot_sum_test::two_digit_number_test": 3, + "alexandria_math::tests::wad_ray_math_test::test_revertWhen_wad_div_zero": 2, + "alexandria_math::tests::wad_ray_math_test::test_revertWhen_ray_div_zero": 2, + "alexandria_math::tests::trigonometry_test::sin_positive_test_3": 2, + "alexandria_math::tests::trigonometry_test::sin_positive_test_2": 2, + "alexandria_math::tests::trigonometry_test::sin_positive_test_1": 2, + "alexandria_math::tests::trigonometry_test::sin_negative_test_2": 2, + "alexandria_math::tests::trigonometry_test::sin_negative_test_1": 2, + "alexandria_math::tests::trigonometry_test::cos_positive_test_1": 2, + "alexandria_math::tests::trigonometry_test::cos_negative_test_1": 2, + "alexandria_math::tests::mod_arithmetics_test::add_mod_2_test": 2, + "alexandria_math::tests::mod_arithmetics_test::add_mod_1_test": 2, + "alexandria_math::tests::i257_test::i257_test_equality": 2, + "alexandria_math::tests::i257_test::i257_test_div_sign_zero": 2, + "alexandria_math::tests::i257_test::i257_test_add": 2, + "alexandria_math::tests::gcd_of_n_numbers_test::gcd_test_inverse": 2, + "alexandria_math::tests::gcd_of_n_numbers_test::gcd_test_3": 2, + "alexandria_math::tests::bitmap_test::test_bitmap_most_significant_bit": 2, + "alexandria_math::tests::bitmap_test::test_bitmap_get_bit_at_0": 2, + "alexandria_math::tests::armstrong_number_test::two_digit_numbers_are_not_armstrong_numbers_test": 2, + "alexandria_math::tests::aliquot_sum_test::one_digit_number_test": 2, + "alexandria_math::tests::u512_arithmetics_test::test_u512_sub": 1, + "alexandria_math::tests::u512_arithmetics_test::test_u512_add": 1, + "alexandria_math::tests::lcm_of_n_numbers_test::lcm_single_test": 1, + "alexandria_math::tests::lcm_of_n_numbers_test::lcm_empty_input_test": 1, + "alexandria_math::tests::is_prime_test::is_prime_test_3": 1, + "alexandria_math::tests::is_prime_test::is_prime_test_2": 1, + "alexandria_math::tests::is_prime_test::is_prime_test_1": 1, + "alexandria_math::tests::is_power_of_two_test::is_power_of_two_test_5": 1, + "alexandria_math::tests::is_power_of_two_test::is_power_of_two_test_4": 1, + "alexandria_math::tests::is_power_of_two_test::is_power_of_two_test_3": 1, + "alexandria_math::tests::is_power_of_two_test::is_power_of_two_test_2": 1, + "alexandria_math::tests::is_power_of_two_test::is_power_of_two_test_1": 1, + "alexandria_math::tests::i257_test::i257_test_is_zero": 1, + "alexandria_math::tests::i257_test::i257_test_into": 1, + "alexandria_math::tests::i257_test::i257_test_eq_not_eq": 1, + "alexandria_math::tests::gcd_of_n_numbers_test::gcd_single_test": 1, + "alexandria_math::tests::gcd_of_n_numbers_test::gcd_empty_input_test": 1, + "alexandria_math::tests::fibonacci_test::fibonacci_test": 1, + "alexandria_math::tests::fast_root_test::fast_nr_optimize_test_2": 1, + "alexandria_math::tests::ed25519_test::verify_signature_invalid_length": 1, + "alexandria_math::tests::collatz_sequence_test::collatz_sequence_empty_test": 1, + "alexandria_math::tests::armstrong_number_test::one_digit_armstrong_number_test": 1, + "alexandria_math::tests::aliquot_sum_test::zero_test": 1, + "alexandria_math::tests::aliquot_sum_test::two_test": 1, + "alexandria_math::tests::aliquot_sum_test::one_test": 1 } diff --git a/scripts/generate_gas_report.sh b/scripts/generate_gas_report.sh index b71d7a59..e4225d2a 100755 --- a/scripts/generate_gas_report.sh +++ b/scripts/generate_gas_report.sh @@ -1,12 +1,12 @@ #!/bin/bash run_tests_and_collect_gas() { - scarb test | grep -E 'test .* \.\.\. ok \(gas usage est\.: [0-9]+\)' | sed -E 's/test (.*) \.\.\. ok \(gas usage est\.: ([0-9]+)\)/\1 \2/' | sort -k2 -nr + scarb test | grep -E '\[PASS\] .* \(gas: ~[0-9]+\)' | sed -E 's/\[PASS\] (.*) \(gas: ~([0-9]+)\)/\1 \2/' | sort -k2 -nr } generate_gas_report() { local gas_data=$(run_tests_and_collect_gas) - + if [ -z "$gas_data" ]; then echo "Error: No gas data found. Make sure 'scarb test' is running correctly." exit 1 @@ -40,4 +40,4 @@ generate_gas_report() { fi } -generate_gas_report \ No newline at end of file +generate_gas_report diff --git a/src/utils/Scarb.toml b/src/utils/Scarb.toml deleted file mode 100644 index e69de29b..00000000