mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add tests
This commit is contained in:
parent
9140bc52c4
commit
2ee748b7f5
12
test/libyul/yulSyntaxTests/assignment_fail.yul
Normal file
12
test/libyul/yulSyntaxTests/assignment_fail.yul
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
let x:u256
|
||||
let y := x
|
||||
let z:bool
|
||||
z := y
|
||||
y := z
|
||||
}
|
||||
// ====
|
||||
// dialect: evmTyped
|
||||
// ----
|
||||
// TypeError: (51-52): Assigning a value of type "u256" to a variable of type "bool".
|
||||
// TypeError: (62-63): Assigning a value of type "bool" to a variable of type "u256".
|
7
test/libyul/yulSyntaxTests/for_loop_condition.yul
Normal file
7
test/libyul/yulSyntaxTests/for_loop_condition.yul
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
let x:bool
|
||||
for {} x {} {}
|
||||
}
|
||||
// ====
|
||||
// dialect: evmTyped
|
||||
// ----
|
8
test/libyul/yulSyntaxTests/for_loop_condition_fail.yul
Normal file
8
test/libyul/yulSyntaxTests/for_loop_condition_fail.yul
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
let x
|
||||
for {} x {} {}
|
||||
}
|
||||
// ====
|
||||
// dialect: evmTyped
|
||||
// ----
|
||||
// TypeError: (23-24): Expected a value of boolean type "bool" but got "u256"
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
let x
|
||||
for {} x {} {}
|
||||
}
|
||||
// ====
|
||||
// dialect: ewasm
|
||||
// ----
|
||||
// TypeError: (23-24): Expected a value of boolean type "i32" but got "i64"
|
8
test/libyul/yulSyntaxTests/type_check_cases.yul
Normal file
8
test/libyul/yulSyntaxTests/type_check_cases.yul
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
switch 7:i64
|
||||
case 0:i64 {}
|
||||
case 2:i64 {}
|
||||
}
|
||||
// ====
|
||||
// dialect: ewasm
|
||||
// ----
|
10
test/libyul/yulSyntaxTests/type_check_cases_fail.yul
Normal file
10
test/libyul/yulSyntaxTests/type_check_cases_fail.yul
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
switch 7:i32
|
||||
case 0:i64 {}
|
||||
case 2:i64 {}
|
||||
}
|
||||
// ====
|
||||
// dialect: ewasm
|
||||
// ----
|
||||
// TypeError: (28-33): Expected a value of type "i32" but got "i64"
|
||||
// TypeError: (46-51): Expected a value of type "i32" but got "i64"
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
switch 7
|
||||
case true:bool {}
|
||||
case true:bool {}
|
||||
}
|
||||
// ====
|
||||
// dialect: evmTyped
|
||||
// ----
|
||||
// TypeError: (24-33): Expected a value of type "u256" but got "bool"
|
||||
// TypeError: (46-55): Expected a value of type "u256" but got "bool"
|
7
test/libyul/yulSyntaxTests/type_check_if_condition.yul
Normal file
7
test/libyul/yulSyntaxTests/type_check_if_condition.yul
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
let x:i32
|
||||
if x {}
|
||||
}
|
||||
// ====
|
||||
// dialect: ewasm
|
||||
// ----
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
let x:i64
|
||||
if x {}
|
||||
}
|
||||
// ====
|
||||
// dialect: ewasm
|
||||
// ----
|
||||
// TypeError: (23-24): Expected a value of boolean type "i32" but got "i64"
|
12
test/libyul/yulSyntaxTests/user_defined_functions_fail.yul
Normal file
12
test/libyul/yulSyntaxTests/user_defined_functions_fail.yul
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
function f(a:u256, b:u256, c:bool) -> r:bool, t {
|
||||
r := lt(a, b)
|
||||
t := bool_to_u256(not(c))
|
||||
}
|
||||
let x, y: bool := f(1, 2: u256, true)
|
||||
}
|
||||
// ====
|
||||
// dialect: evmTyped
|
||||
// ----
|
||||
// TypeError: (126-127): Assigning value of type "bool" to variable of type "u256.
|
||||
// TypeError: (129-136): Assigning value of type "u256" to variable of type "bool.
|
10
test/libyul/yulSyntaxTests/user_defined_functions_fine.yul
Normal file
10
test/libyul/yulSyntaxTests/user_defined_functions_fine.yul
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
function f(a:u256, b:u256, c:bool) -> r:bool, t {
|
||||
r := lt(a, b)
|
||||
t := bool_to_u256(not(c))
|
||||
}
|
||||
let x: bool, y: u256 := f(1, 2: u256, true)
|
||||
}
|
||||
// ====
|
||||
// dialect: evmTyped
|
||||
// ----
|
Loading…
Reference in New Issue
Block a user