-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
206 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
out | ||
target |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute/Forc.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[[package]] | ||
name = "core" | ||
source = "path+from-root-E4EB5F90E61EC58F" | ||
|
||
[[package]] | ||
name = "transmute" | ||
source = "member" | ||
dependencies = ["core"] |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute/Forc.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[project] | ||
authors = ["Fuel Labs <contact@fuel.sh>"] | ||
license = "Apache-2.0" | ||
entry = "main.sw" | ||
name = "transmute" | ||
|
||
[dependencies] | ||
core = { path = "../../../../../../../../sway-lib-core" } |
28 changes: 28 additions & 0 deletions
28
...vm_tests/test_programs/should_fail/language/intrinsics/transmute/debug/transmute-abi.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"programType": "script", | ||
"specVersion": "1", | ||
"encodingVersion": "1", | ||
"concreteTypes": [ | ||
{ | ||
"type": "u64", | ||
"concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" | ||
} | ||
], | ||
"metadataTypes": [], | ||
"functions": [ | ||
{ | ||
"inputs": [], | ||
"name": "main", | ||
"output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", | ||
"attributes": null | ||
} | ||
], | ||
"loggedTypes": [ | ||
{ | ||
"logId": "1515152261580153489", | ||
"concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" | ||
} | ||
], | ||
"messagesTypes": [], | ||
"configurables": [] | ||
} |
1 change: 1 addition & 0 deletions
1
...vm_tests/test_programs/should_fail/language/intrinsics/transmute/debug/transmute-bin-hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0x82d76771fa3e7e2cc3c0f9904b45673c9066384f3077cd97e20892c965a096db |
Binary file added
BIN
+1.06 KB
.../e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute/debug/transmute.bin
Binary file not shown.
Empty file.
16 changes: 16 additions & 0 deletions
16
test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute/src/main.sw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
script; | ||
|
||
fn main() { | ||
// Missing type arguments | ||
let _ = __transmute(1u64); | ||
let _ = __transmute::<u64>(1u64); | ||
|
||
// Wrong source type | ||
let _ = __transmute::<u64, u8>(1u32); | ||
|
||
// Different sizes | ||
let _ = __transmute::<u64, u8>(1u64); | ||
|
||
// Invalid types | ||
let _ = __transmute::<&u64, &u8>(&1u64); | ||
} |
62 changes: 62 additions & 0 deletions
62
test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute/stdout.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
source: test/tests/tests.rs | ||
snapshot_kind: text | ||
--- | ||
> forc build --path test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute | ||
exit status: 1 | ||
output: | ||
Building test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute | ||
Compiling library core (sway-lib-core) | ||
Compiling script transmute (test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute) | ||
error | ||
--> test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute/src/main.sw:5:13 | ||
| | ||
3 | fn main() { | ||
4 | // Missing type arguments | ||
5 | let _ = __transmute(1u64); | ||
| ^^^^^^^^^^^^^^^^^ Call to "transmute" expects 2 type arguments | ||
6 | let _ = __transmute::<u64>(1u64); | ||
7 | | ||
| | ||
____ | ||
|
||
error | ||
--> test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute/src/main.sw:6:13 | ||
| | ||
4 | // Missing type arguments | ||
5 | let _ = __transmute(1u64); | ||
6 | let _ = __transmute::<u64>(1u64); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ Call to "transmute" expects 2 type arguments | ||
7 | | ||
8 | // Wrong source type | ||
| | ||
____ | ||
|
||
error | ||
--> test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute/src/main.sw:9:36 | ||
| | ||
7 | | ||
8 | // Wrong source type | ||
9 | let _ = __transmute::<u64, u8>(1u32); | ||
| ^^^^ Mismatched types. | ||
expected: u64 | ||
found: u32. | ||
|
||
10 | | ||
11 | // Different sizes | ||
| | ||
____ | ||
|
||
error | ||
--> test/src/e2e_vm_tests/test_programs/should_fail/language/intrinsics/transmute/src/main.sw:15:27 | ||
| | ||
13 | | ||
14 | // Invalid types | ||
15 | let _ = __transmute::<&u64, &u8>(&1u64); | ||
| ^^^^ references, pointers, slices, string slices or types containing any of these are not allowed. | ||
16 | } | ||
| | ||
____ | ||
|
||
Aborting due to 4 errors. | ||
error: Failed to compile transmute |
23 changes: 23 additions & 0 deletions
23
...test_programs/should_pass/language/intrinsics/transmute/json_abi_oracle_new_encoding.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"concreteTypes": [ | ||
{ | ||
"concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", | ||
"type": "u64" | ||
} | ||
], | ||
"configurables": [], | ||
"encodingVersion": "1", | ||
"functions": [ | ||
{ | ||
"attributes": null, | ||
"inputs": [], | ||
"name": "main", | ||
"output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" | ||
} | ||
], | ||
"loggedTypes": [], | ||
"messagesTypes": [], | ||
"metadataTypes": [], | ||
"programType": "script", | ||
"specVersion": "1" | ||
} |
5 changes: 3 additions & 2 deletions
5
test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/transmute/src/main.sw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
script; | ||
|
||
fn main() -> u64 { | ||
let a = 1u8; | ||
__transmute::<[u8;4], u64>([0u8, 0u8, 0u8, a]) | ||
let a = __transmute::<[u8; 8], u64>([0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8]); | ||
let b = __transmute::<(u64,), u64>((2,)); | ||
a + b | ||
} |
2 changes: 1 addition & 1 deletion
2
test/src/e2e_vm_tests/test_programs/should_pass/language/intrinsics/transmute/test.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
category = "run" | ||
expected_result = { action = "return", value = 1 } | ||
expected_result_new_encoding = { action = "return_data", value = "01" } | ||
expected_result_new_encoding = { action = "return_data", value = "00 00 00 00 00 00 00 03" } | ||
validate_abi = true |