Skip to content

Commit efd91b5

Browse files
committed
Update test cases
1 parent 0e69371 commit efd91b5

File tree

22 files changed

+48
-54
lines changed

22 files changed

+48
-54
lines changed

forc-plugins/forc-client/tests/deploy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ async fn test_simple_deploy() {
377377
node.kill().unwrap();
378378
let expected = vec![DeployedPackage::Contract(DeployedContract {
379379
id: ContractId::from_str(
380-
"b45b5f58ff2f05c3593ffe4241188c14644aaa1e42dc7defae12b8d09cc6a292",
380+
"654c47c7cc216cd33480712fccf5998ba89874e669ee9b07d4f835f3cba85aba",
381381
)
382382
.unwrap(),
383383
proxy: None,
@@ -421,7 +421,7 @@ async fn test_deploy_submit_only() {
421421
node.kill().unwrap();
422422
let expected = vec![DeployedPackage::Contract(DeployedContract {
423423
id: ContractId::from_str(
424-
"b45b5f58ff2f05c3593ffe4241188c14644aaa1e42dc7defae12b8d09cc6a292",
424+
"654c47c7cc216cd33480712fccf5998ba89874e669ee9b07d4f835f3cba85aba",
425425
)
426426
.unwrap(),
427427
proxy: None,
@@ -468,7 +468,7 @@ async fn test_deploy_fresh_proxy() {
468468
node.kill().unwrap();
469469
let impl_contract = DeployedPackage::Contract(DeployedContract {
470470
id: ContractId::from_str(
471-
"b45b5f58ff2f05c3593ffe4241188c14644aaa1e42dc7defae12b8d09cc6a292",
471+
"654c47c7cc216cd33480712fccf5998ba89874e669ee9b07d4f835f3cba85aba",
472472
)
473473
.unwrap(),
474474
proxy: Some(

sway-ir/src/irtype.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -753,32 +753,26 @@ mod tests {
753753
}
754754

755755
#[test]
756-
/// `u8`, when not embedded in aggregates, has a size of 1 byte.
757-
fn unsigned_u8() {
756+
/// Aligned size is always 8 bytes, while unaligned is the size of the type.
757+
fn unsigned_u8_u16_u32_u64() {
758758
let context = create_context();
759759

760760
let s_u8 = Type::get_uint8(&context).size(&context);
761-
762-
assert_eq!(s_u8.in_bytes(), 1);
763-
}
764-
765-
#[test]
766-
/// `u16`, `u32`, and `u64,`, when not embedded in aggregates, have a size of 8 bytes/1 word.
767-
fn unsigned_u16_u32_u64() {
768-
let context = create_context();
769-
770761
let s_u16 = Type::get_uint16(&context).size(&context);
771762
let s_u32 = Type::get_uint32(&context).size(&context);
772763
let s_u64 = Type::get_uint64(&context).size(&context);
773764

774-
assert_eq!(s_u16.in_bytes(), 8);
775-
assert_eq!(s_u16.in_bytes(), s_u16.in_bytes_aligned());
765+
assert_eq!(s_u8.in_bytes(), 1);
766+
assert_eq!(s_u8.in_bytes_aligned(), 8);
767+
768+
assert_eq!(s_u16.in_bytes(), 2);
769+
assert_eq!(s_u16.in_bytes_aligned(), 8);
776770

777-
assert_eq!(s_u32.in_bytes(), 8);
778-
assert_eq!(s_u32.in_bytes(), s_u32.in_bytes_aligned());
771+
assert_eq!(s_u32.in_bytes(), 4);
772+
assert_eq!(s_u32.in_bytes_aligned(), 8);
779773

780774
assert_eq!(s_u64.in_bytes(), 8);
781-
assert_eq!(s_u64.in_bytes(), s_u64.in_bytes_aligned());
775+
assert_eq!(s_u64.in_bytes_aligned(), 8);
782776
}
783777

784778
#[test]

test/src/e2e_vm_tests/test_programs/should_pass/language/attributes_deprecated/stdout.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,4 @@ warning: Function is deprecated
182182
____
183183

184184
Compiled contract "attributes_deprecated" with 19 warnings.
185-
Finished release [optimized + fuel] target(s) [752 B] in ???
185+
Finished release [optimized + fuel] target(s) [736 B] in ???

test/src/e2e_vm_tests/test_programs/should_pass/language/const_generics/stdout.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ output:
292292
Building test/src/e2e_vm_tests/test_programs/should_pass/language/const_generics
293293
Compiling library std (sway-lib-std)
294294
Compiling script const_generics (test/src/e2e_vm_tests/test_programs/should_pass/language/const_generics)
295-
Finished debug [unoptimized + fuel] target(s) [6.952 KB] in ???
295+
Finished debug [unoptimized + fuel] target(s) [6.704 KB] in ???
296296
Running 1 test, filtered 0 tests
297297

298298
tested -- const_generics

test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/dbg/stdout.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ output:
7171
Building test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/dbg
7272
Compiling library std (sway-lib-std)
7373
Compiling script dbg (test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/dbg)
74-
Finished debug [unoptimized + fuel] target(s) [41.536 KB] in ???
74+
Finished debug [unoptimized + fuel] target(s) [39.824 KB] in ???
7575
Running 1 test, filtered 0 tests
7676

7777
tested -- dbg

test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panic_handling_in_unit_tests/stdout.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ warning: Error message is empty
1818
____
1919

2020
Compiled script "panic_handling_in_unit_tests" with 1 warning.
21-
Finished debug [unoptimized + fuel] target(s) [9.504 KB] in ???
21+
Finished debug [unoptimized + fuel] target(s) [9.208 KB] in ???
2222
Running 2 tests, filtered 18 tests
2323

2424
tested -- panic_handling_in_unit_tests
@@ -55,7 +55,7 @@ warning: Error message is empty
5555
____
5656

5757
Compiled script "panic_handling_in_unit_tests" with 1 warning.
58-
Finished debug [unoptimized + fuel] target(s) [9.504 KB] in ???
58+
Finished debug [unoptimized + fuel] target(s) [9.208 KB] in ???
5959
Running 20 tests, filtered 0 tests
6060

6161
tested -- panic_handling_in_unit_tests

test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_contract/stdout.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,78 +8,78 @@ output:
88
Compiling library std (test/src/e2e_vm_tests/reduced_std_libs/sway-lib-std-core)
99
Compiling library panicking_lib (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib)
1010
Compiling contract panicking_contract (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_contract)
11-
Finished release [optimized + fuel] target(s) [7.936 KB] in ???
11+
Finished release [optimized + fuel] target(s) [7.656 KB] in ???
1212
Running 11 tests, filtered 0 tests
1313

1414
tested -- panicking_contract
1515

16-
test test_directly_panicking_method ... ok (???, 1595 gas)
16+
test test_directly_panicking_method ... ok (???, 1594 gas)
1717
revert code: ffffffff00000000
1818
├─ panic message: Error C.
1919
├─ panic value: C(true)
2020
└─ panicked in: panicking_contract@1.2.3, src/main.sw:22:9
2121
decoded log values:
2222
C(true), log rb: 5503570629422409978
23-
test test_nested_panic_inlined ... ok (???, 2913 gas)
23+
test test_nested_panic_inlined ... ok (???, 2912 gas)
2424
revert code: ffffffff00000005
2525
├─ panic message: Error E.
2626
├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }])
2727
└─ panicked in: panicking_lib, src/lib.sw:41:9
2828
decoded log values:
2929
E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 5503570629422409978
30-
test test_nested_panic_inlined_same_revert_code ... ok (???, 2913 gas)
30+
test test_nested_panic_inlined_same_revert_code ... ok (???, 2912 gas)
3131
revert code: ffffffff00000005
3232
├─ panic message: Error E.
3333
├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }])
3434
└─ panicked in: panicking_lib, src/lib.sw:41:9
3535
decoded log values:
3636
E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 5503570629422409978
37-
test test_nested_panic_not_inlined ... ok (???, 3110 gas)
37+
test test_nested_panic_not_inlined ... ok (???, 3109 gas)
3838
revert code: ffffffff00000006
3939
├─ panic message: Error E.
4040
├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }])
4141
└─ panicked in: panicking_lib, src/lib.sw:35:5
4242
decoded log values:
4343
E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 5503570629422409978
44-
test test_nested_panic_not_inlined_same_revert_code ... ok (???, 3110 gas)
44+
test test_nested_panic_not_inlined_same_revert_code ... ok (???, 3109 gas)
4545
revert code: ffffffff00000006
4646
├─ panic message: Error E.
4747
├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }])
4848
└─ panicked in: panicking_lib, src/lib.sw:35:5
4949
decoded log values:
5050
E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 5503570629422409978
51-
test test_generic_panic_with_unit ... ok (???, 2035 gas)
51+
test test_generic_panic_with_unit ... ok (???, 2034 gas)
5252
revert code: ffffffff00000004
5353
├─ panic value: ()
5454
└─ panicked in: panicking_lib, src/lib.sw:74:5
5555
decoded log values:
5656
(), log rb: 3330666440490685604
57-
test test_generic_panic_with_unit_same_revert_code ... ok (???, 2035 gas)
57+
test test_generic_panic_with_unit_same_revert_code ... ok (???, 2034 gas)
5858
revert code: ffffffff00000004
5959
├─ panic value: ()
6060
└─ panicked in: panicking_lib, src/lib.sw:74:5
6161
decoded log values:
6262
(), log rb: 3330666440490685604
63-
test test_generic_panic_with_str ... ok (???, 2057 gas)
63+
test test_generic_panic_with_str ... ok (???, 2056 gas)
6464
revert code: ffffffff00000002
6565
├─ panic message: generic panic with string
6666
└─ panicked in: panicking_lib, src/lib.sw:74:5
6767
decoded log values:
6868
AsciiString { data: "generic panic with string" }, log rb: 10098701174489624218
69-
test test_generic_panic_with_different_str_same_revert_code ... ok (???, 1730 gas)
69+
test test_generic_panic_with_different_str_same_revert_code ... ok (???, 1729 gas)
7070
revert code: ffffffff00000002
7171
├─ panic message: generic panic with different string
7272
└─ panicked in: panicking_lib, src/lib.sw:74:5
7373
decoded log values:
7474
AsciiString { data: "generic panic with different string" }, log rb: 10098701174489624218
75-
test test_generic_panic_with_error_type_enum ... ok (???, 1854 gas)
75+
test test_generic_panic_with_error_type_enum ... ok (???, 1853 gas)
7676
revert code: ffffffff00000003
7777
├─ panic message: Error A.
7878
├─ panic value: A
7979
└─ panicked in: panicking_lib, src/lib.sw:74:5
8080
decoded log values:
8181
A, log rb: 5503570629422409978
82-
test test_generic_panic_with_error_type_enum_different_variant_same_revert_code ... ok (???, 2023 gas)
82+
test test_generic_panic_with_error_type_enum_different_variant_same_revert_code ... ok (???, 2022 gas)
8383
revert code: ffffffff00000003
8484
├─ panic message: Error B.
8585
├─ panic value: B(42)

test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib/stdout.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ output:
77
Building test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib
88
Compiling library std (test/src/e2e_vm_tests/reduced_std_libs/sway-lib-std-core)
99
Compiling library panicking_lib (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib)
10-
Finished release [optimized + fuel] target(s) [5.68 KB] in ???
10+
Finished release [optimized + fuel] target(s) [5.648 KB] in ???
1111
Running 18 tests, filtered 0 tests
1212

1313
tested -- panicking_lib

test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_script/stdout.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ output:
88
Compiling library std (test/src/e2e_vm_tests/reduced_std_libs/sway-lib-std-core)
99
Compiling library panicking_lib (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib)
1010
Compiling script panicking_script (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_script)
11-
Finished release [optimized + fuel] target(s) [3.712 KB] in ???
11+
Finished release [optimized + fuel] target(s) [3.68 KB] in ???
1212
Running 11 tests, filtered 0 tests
1313

1414
tested -- panicking_script

test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/array_of_structs_caller/src/main.sw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::hash::*;
66
#[cfg(experimental_new_encoding = false)]
77
const CONTRACT_ID = 0x14ed3cd06c2947248f69d54bfa681fe40d26267be84df7e19e253622b7921bbe;
88
#[cfg(experimental_new_encoding = true)]
9-
const CONTRACT_ID = 0xf106a79029b4b175cbd3c403328947431c4cc39913d5c03bb88011a190cf7cd1; // AUTO-CONTRACT-ID ../../test_contracts/array_of_structs_contract --release
9+
const CONTRACT_ID = 0x0e2a44193851f9d58b1fe0b96de2f585831f98fefe82d2cc9fb3611db3a70d30; // AUTO-CONTRACT-ID ../../test_contracts/array_of_structs_contract --release
1010

1111
fn get_address() -> Option<std::address::Address> {
1212
Some(CONTRACT_ID.into())

0 commit comments

Comments
 (0)