diff --git a/test/src/in_language_tests/test_programs/alloc_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/alloc_inline_tests/src/main.sw index 04a9b08462a..54c9536290f 100644 --- a/test/src/in_language_tests/test_programs/alloc_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/alloc_inline_tests/src/main.sw @@ -41,15 +41,7 @@ fn alloc_alloc() { iter += 1; } - // Can alloc enum - // let identity_ptr = alloc::(1); - // assert(identity_ptr.read::() == Identity::Address(Address::zero())); - // identity_ptr.write(Identity::Address(Address::from(b256::max()))); - // assert( - // identity_ptr - // .read::() == Identity::Address(Address::from(b256::max())), - // ); - + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // Can alloc array // let array_ptr = alloc::<[u64; 1]>(2); // assert(array_ptr.read::() == 0u64); @@ -103,20 +95,7 @@ fn alloc_realloc() { assert(realloc_address_ptr.read::
() == Address::from(b256::max())); assert(realloc_address_ptr.add::
(1).read::
() == Address::zero()); - // Can alloc enum - // let identity_ptr = alloc::(1); - // identity_ptr.write(Identity::Address(Address::from(b256::max()))); - // let realloc_identity_ptr = realloc::(identity_ptr, 1, 2); - // assert( - // realloc_identity_ptr - // .read::() == Identity::Address(Address::from(b256::max())), - // ); - // assert( - // realloc_identity_ptr - // .add::(1) - // .read::() == Identity::Address(Address::from(b256::zero())), - // ); - + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // Can realloc array // let array_ptr = alloc::<[u64; 1]>(2); // array_ptr.write(u64::max()); @@ -214,15 +193,7 @@ fn alloc_alloc_bytes() { address_ptr.write(Address::from(b256::max())); assert(address_ptr.read::
() == Address::from(b256::max())); - // Can alloc enum - // let identity_ptr = alloc_bytes(__size_of_val::(Identity::Address(Address::zero()))); - // assert(identity_ptr.read::() == Identity::Address(Address::zero())); - // identity_ptr.write(Identity::Address(Address::from(b256::max()))); - // assert( - // identity_ptr - // .read::() == Identity::Address(Address::from(b256::max())), - // ); - + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // Can alloc array // let array_ptr = alloc_bytes(__size_of::<[u64; 1]>() * 2); // assert(array_ptr.read::() == 0u64); @@ -289,24 +260,7 @@ fn alloc_realloc_bytes() { assert(realloc_address_ptr.read::
() == Address::from(b256::max())); assert(realloc_address_ptr.add::
(1).read::
() == Address::zero()); - // Can alloc enum - // let identity_ptr = alloc_bytes(__size_of_val::(Identity::Address(Address::zero()))); - // identity_ptr.write(Identity::Address(Address::from(b256::max()))); - // let realloc_identity_ptr = realloc_bytes( - // identity_ptr, - // __size_of_val::(Identity::Address(Address::zero())), - // __size_of_val::(Identity::Address(Address::zero())) * 2, - // ); - // assert( - // realloc_identity_ptr - // .read::() == Identity::Address(Address::from(b256::max())), - // ); - // assert( - // realloc_identity_ptr - // .add::(1) - // .read::() == Identity::Address(Address::from(b256::zero())), - // ); - + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // Can realloc array // let array_ptr = alloc_bytes(__size_of::<[u64; 1]>() * 2); // array_ptr.write(u64::max()); diff --git a/test/src/in_language_tests/test_programs/assert_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/assert_inline_tests/src/main.sw index a1a62ca1727..916bd7fea4a 100644 --- a/test/src/in_language_tests/test_programs/assert_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/assert_inline_tests/src/main.sw @@ -67,6 +67,7 @@ fn assert_assert_eq() { p.push(69u8); assert_eq(o, p); + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved. // assert_eq array // let value = 0xBEEFBEEFBEEFBEEFBEEFBEEFBEEFBEEFBEEFBEEFBEEFBEEFBEEFBEEFBEEFBEEF; // let mut q: [u64; 3] = [0, 0, 0]; @@ -146,6 +147,7 @@ fn assert_assert_ne() { p.push(70u8); assert_ne(o, p); + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved. // assert_ne array // let mut q: [u64; 3] = [1, 2, 3]; // let mut r: [u64; 3] = [0, 0, 0]; diff --git a/test/src/in_language_tests/test_programs/ecr_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/ecr_inline_tests/src/main.sw index 853710b285e..e11471b2cbe 100644 --- a/test/src/in_language_tests/test_programs/ecr_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/ecr_inline_tests/src/main.sw @@ -60,7 +60,7 @@ fn ecr_ec_recover_r1() { let msg_hash_2 = 0x1e45523606c96c98ba970ff7cf9511fab8b25e1bcd52ced30b81df1e4a9c4323; let signature_2: B512 = B512::from((hi_2, lo_2)); let result_2 = ec_recover_r1(signature_2, msg_hash_2); - + assert(result_2.is_err()); } @@ -81,7 +81,7 @@ fn ecr_ec_recover_address() { let msg_hash_2 = 0xee45573606c96c98ba970ff7cf9511f1b8b25e6bcd52ced30b89df1e4a9c4323; let signature_2: B512 = B512::from((hi_2, lo_2)); let result_2 = ec_recover_address(signature_2, msg_hash_2); - + assert(result_2.is_err()); } diff --git a/test/src/in_language_tests/test_programs/hash_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/hash_inline_tests/src/main.sw index 6aa8a6b332f..ccef01df70f 100644 --- a/test/src/in_language_tests/test_programs/hash_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/hash_inline_tests/src/main.sw @@ -2,8 +2,6 @@ library; use std::{bytes::Bytes, hash::{Hash, Hasher, keccak256, sha256, sha256_str_array},}; -// NOTE: There are no tests for the Hasher struct as there is nothing that can be asserted - #[test()] fn hash_hasher_write_str() { let mut hasher = Hasher::new(); diff --git a/test/src/in_language_tests/test_programs/identity_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/identity_inline_tests/src/main.sw index 4d0325a196c..b6f5d148622 100644 --- a/test/src/in_language_tests/test_programs/identity_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/identity_inline_tests/src/main.sw @@ -1,7 +1,5 @@ library; -use std::hash::{Hash, sha256}; - #[test] fn identity_eq() { let address1 = Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000000)); @@ -217,20 +215,33 @@ fn identity_bits() { ); } -// #[test] -// fn identity_hash() { -// let address1 = Identity::Address(Address::zero()); -// let address2 = Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)); -// let address3 = Identity::Address(Address::from(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)); -// let contract_id1 = Identity::ContractId(ContractId::zero()); -// let contract_id2 = Identity::ContractId(ContractId::from(0x0000000000000000000000000000000000000000000000000000000000000001)); -// let contract_id3 = Identity::ContractId(ContractId::from(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)); - - -// assert(sha256(address1) == 0x0000000000000000000000000000000000000000000000000000000000000001); -// assert(sha256(contract_id1) == b256::zero()); -// assert(sha256(address2) == 0x0000000000000000000000000000000000000000000000000000000000000001); -// assert(sha256(contract_id2) == 0x0000000000000000000000000000000000000000000000000000000000000001); -// assert(sha256(address3) == 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); -// assert(sha256(contract_id3) == 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); -// } +#[test] +fn identity_hash() { + use std::hash::{Hash, sha256}; + + let address1 = Identity::Address(Address::zero()); + let address2 = Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)); + let address3 = Identity::Address(Address::from(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)); + let contract_id1 = Identity::ContractId(ContractId::zero()); + let contract_id2 = Identity::ContractId(ContractId::from(0x0000000000000000000000000000000000000000000000000000000000000001)); + let contract_id3 = Identity::ContractId(ContractId::from(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)); + + assert( + sha256(address1) == 0x7f9c9e31ac8256ca2f258583df262dbc7d6f68f2a03043d5c99a4ae5a7396ce9, + ); + assert( + sha256(contract_id1) == 0x1a7dfdeaffeedac489287e85be5e9c049a2ff6470f55cf30260f55395ac1b159, + ); + assert( + sha256(address2) == 0x1fd4247443c9440cb3c48c28851937196bc156032d70a96c98e127ecb347e45f, + ); + assert( + sha256(contract_id2) == 0x2e255099d6d6bee307c8e7075acc78f949897c5f67b53adf60724c814d7b90cb, + ); + assert( + sha256(address3) == 0x5e16d316ecd5773e50c3b02737d424192b02f25b4245822079181c557aafda7d, + ); + assert( + sha256(contract_id3) == 0x29fb7cd3be48a8d76bb031f0abce26caa9e092c000cd16bb101d30f63c4c1bc1, + ); +} diff --git a/test/src/in_language_tests/test_programs/math_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/math_inline_tests/src/main.sw index 035cd1dbc01..02e0cc2458b 100644 --- a/test/src/in_language_tests/test_programs/math_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/math_inline_tests/src/main.sw @@ -1,7 +1,5 @@ library; -// NO IMPLEMENTATION FOR "Exponent" TRAIT - #[test] fn math_root_u256() { let max_u256 = u256::max(); diff --git a/test/src/in_language_tests/test_programs/option_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/option_inline_tests/src/main.sw index c68afa0a77f..7ca19c1d4d7 100644 --- a/test/src/in_language_tests/test_programs/option_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/option_inline_tests/src/main.sw @@ -20,8 +20,8 @@ fn option_eq() { let struct_2 = Some(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)); let enum_1 = Some(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001))); let enum_2 = Some(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001))); - // let array_1 = Some([0u64, 0u64]); - // let array_2 = Some([0u64, 0u64]); + let _array_1 = Some([0u64, 0u64]); + let _array_2 = Some([0u64, 0u64]); let mut bytes_1 = Bytes::new(); bytes_1.push(1u8); let mut bytes_2 = Bytes::new(); @@ -39,6 +39,7 @@ fn option_eq() { assert(b256_1 == b256_2); assert(struct_1 == struct_2); assert(enum_1 == enum_2); + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // assert(array_1 == array_2); assert(heap_1 == heap_2); assert(none_1 == none_2); @@ -64,8 +65,8 @@ fn option_ne() { let struct_2 = Some(Address::from(0x0000000000000000000000000000000000000000000000000000000000000002)); let enum_1 = Some(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001))); let enum_2 = Some(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000002))); - // let array_1 = Some([0u64, 0u64]); - // let array_2 = Some([0u64, 1u64]); + let _array_1 = Some([0u64, 0u64]); + let _array_2 = Some([0u64, 1u64]); let mut bytes_1 = Bytes::new(); bytes_1.push(1u8); let mut bytes_2 = Bytes::new(); @@ -82,6 +83,7 @@ fn option_ne() { assert(b256_1 != b256_2); assert(struct_1 != struct_2); assert(enum_1 != enum_2); + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // assert(array_1 != array_2); assert(heap_1 != heap_2); assert(none_1 != u64_1); @@ -161,7 +163,7 @@ fn option_unwrap() { let b256_1 = Some(0x0000000000000000000000000000000000000000000000000000000000000001); let struct_1 = Some(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)); let enum_1 = Some(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001))); - // let array_1 = Some([0u64, 0u64]); + let _array_1 = Some([0u64, 0u64]); let mut bytes_1 = Bytes::new(); bytes_1.push(1u8); let heap_1 = Some(bytes_1); @@ -183,6 +185,7 @@ fn option_unwrap() { enum_1 .unwrap() == Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)), ); + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // assert(array_1.unwrap() == [0u64, 0u64]); assert(heap_1.unwrap() == bytes_1); } @@ -205,7 +208,7 @@ fn option_unwrap_or() { let b256_1 = Some(0x0000000000000000000000000000000000000000000000000000000000000001); let struct_1 = Some(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)); let enum_1 = Some(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001))); - // let array_1 = Some([0u64, 0u64]); + let _array_1 = Some([0u64, 0u64]); let mut bytes_1 = Bytes::new(); bytes_1.push(1u8); let heap_1 = Some(bytes_1); @@ -228,6 +231,7 @@ fn option_unwrap_or() { enum_1 .unwrap_or(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000002))) == Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)), ); + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // assert(array_1.unwrap_or([1u64, 1u64]) == [0u64, 0u64]); assert(heap_1.unwrap_or(Bytes::new()) == bytes_1); assert(none_1.unwrap_or(10u64) == 10u64); @@ -245,7 +249,7 @@ fn option_ok_or() { let b256_1 = Some(0x0000000000000000000000000000000000000000000000000000000000000001); let struct_1 = Some(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)); let enum_1 = Some(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001))); - //let array_1 = Some([0u64, 0u64]); + let _array_1 = Some([0u64, 0u64]); let mut bytes_1 = Bytes::new(); bytes_1.push(1u8); let heap_1 = Some(bytes_1); @@ -289,6 +293,7 @@ fn option_ok_or() { ), Result::Err => revert(0), }; + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // match array_1.ok_or([1u64, 1u64]) { // Result::Ok(underlying) => assert(underlying == [0u64, 0u64]), // Result::Err => revert(0), @@ -315,7 +320,7 @@ fn option_expect() { let b256_1 = Some(0x0000000000000000000000000000000000000000000000000000000000000001); let struct_1 = Some(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)); let enum_1 = Some(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001))); - // let array_1 = Some([0u64, 0u64]); + let _array_1 = Some([0u64, 0u64]); let mut bytes_1 = Bytes::new(); bytes_1.push(1u8); let heap_1 = Some(bytes_1); @@ -337,6 +342,7 @@ fn option_expect() { enum_1 .expect("Failed Test") == Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)), ); + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // assert(array_1.expect("Failed Test") == [0u64, 0u64]); assert(heap_1.expect("Failed Test") == bytes_1); } diff --git a/test/src/in_language_tests/test_programs/result_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/result_inline_tests/src/main.sw index 9337668f90f..2166d4b643b 100644 --- a/test/src/in_language_tests/test_programs/result_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/result_inline_tests/src/main.sw @@ -74,7 +74,7 @@ fn result_unwrap() { let b256_1: Result = Ok(0x0000000000000000000000000000000000000000000000000000000000000001); let struct_1: Result = Ok(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)); let enum_1: Result = Ok(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001))); - // let array_1: Result<[u64; 2], str> = Ok([0u64, 0u64]); + let _array_1: Result<[u64; 2], str> = Ok([0u64, 0u64]); let mut bytes_1 = Bytes::new(); bytes_1.push(1u8); let heap_1: Result = Ok(bytes_1); @@ -96,6 +96,7 @@ fn result_unwrap() { enum_1 .unwrap() == Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)), ); + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // assert(array_1.unwrap() == [0u64, 0u64]); assert(heap_1.unwrap() == bytes_1); } @@ -118,7 +119,7 @@ fn result_unwrap_or() { let b256_1: Result = Ok(0x0000000000000000000000000000000000000000000000000000000000000001); let struct_1: Result = Ok(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)); let enum_1: Result = Ok(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001))); - // let array_1: Result<[u64; 2], str> = Ok([0u64, 0u64]); + let _array_1: Result<[u64; 2], str> = Ok([0u64, 0u64]); let mut bytes_1 = Bytes::new(); bytes_1.push(1u8); let heap_1: Result = Ok(bytes_1); @@ -141,6 +142,7 @@ fn result_unwrap_or() { enum_1 .unwrap_or(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000002))) == Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)), ); + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // assert(array_1.unwrap_or([1u64, 1u64]) == [0u64, 0u64]); assert(heap_1.unwrap_or(Bytes::new()) == bytes_1); assert(err_1.unwrap_or(10u64) == 10u64); @@ -158,7 +160,7 @@ fn result_expect() { let b256_1: Result = Ok(0x0000000000000000000000000000000000000000000000000000000000000001); let struct_1: Result = Ok(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)); let enum_1: Result = Ok(Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001))); - // let array_1: Result<[u64; 2], str> = Ok([0u64, 0u64]); + let _array_1: Result<[u64; 2], str> = Ok([0u64, 0u64]); let mut bytes_1 = Bytes::new(); bytes_1.push(1u8); let heap_1: Result = Ok(bytes_1); @@ -180,6 +182,7 @@ fn result_expect() { enum_1 .expect("Failed Test") == Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000001)), ); + // TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6086 is resolved // assert(array_1.expect("Failed Test") == [0u64, 0u64]); assert(heap_1.expect("Failed Test") == bytes_1); } diff --git a/test/src/in_language_tests/test_programs/vec_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/vec_inline_tests/src/main.sw index d442cc790f2..5ac6a8fef32 100644 --- a/test/src/in_language_tests/test_programs/vec_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/vec_inline_tests/src/main.sw @@ -645,7 +645,7 @@ fn vec_from_raw_slice() { assert(vec.len() == slice.len::()); } -// Uncomment when https://github.com/FuelLabs/sway/issues/6085 is resolved +// TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6085 is resolved // #[test()] // fn vec_into_raw_slice() { // // Glob operator needed for From for raw_slice @@ -659,7 +659,7 @@ fn vec_from_raw_slice() { // assert(vec.len() == slice.len::()); // } -// Uncomment when https://github.com/FuelLabs/sway/issues/6085 is resolved +// TODO: Uncomment when https://github.com/FuelLabs/sway/issues/6085 is resolved // #[test()] // fn vec_raw_slice_from() { // // Glob operator needed for From for raw_slice diff --git a/test/src/in_language_tests/test_programs/vm_evm_ecr_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/vm_evm_ecr_inline_tests/src/main.sw index ac1c560199f..f676386a47c 100644 --- a/test/src/in_language_tests/test_programs/vm_evm_ecr_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/vm_evm_ecr_inline_tests/src/main.sw @@ -1,12 +1,6 @@ library; -use std::{ - b512::B512, - vm::evm::{ - evm_address::EvmAddress, - ecr::ec_recover_evm_address, - } -}; +use std::{b512::B512, vm::evm::{ecr::ec_recover_evm_address, evm_address::EvmAddress,}}; #[test] fn ecr_ec_recover() { @@ -27,7 +21,6 @@ fn ecr_ec_recover() { let signature_2: B512 = B512::from((hi_2, lo_2)); let result_2 = ec_recover_evm_address(signature_2, msg_hash_2); - + assert(result_2.is_err()); } -