From 6e32a1becb90728f3a3bcbbc83a8e6c94f5e000c Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 10 Oct 2018 15:15:38 +0200 Subject: [PATCH] Disambiguator tests. --- .../disambiguator/for_statement.yul | 28 +++++++++++++++++++ .../disambiguator/funtion_call.yul | 22 +++++++++++++++ .../disambiguator/if_statement.yul | 22 +++++++++++++++ .../yulOptimizerTests/disambiguator/smoke.yul | 5 ++++ .../disambiguator/smoke_yul.yul | 6 ++++ .../disambiguator/switch_statement.yul | 27 ++++++++++++++++++ .../disambiguator/variables.yul | 12 ++++++++ .../disambiguator/variables_clash.yul | 13 +++++++++ .../variables_inside_functions.yul | 24 ++++++++++++++++ 9 files changed, 159 insertions(+) create mode 100644 test/libjulia/yulOptimizerTests/disambiguator/for_statement.yul create mode 100644 test/libjulia/yulOptimizerTests/disambiguator/funtion_call.yul create mode 100644 test/libjulia/yulOptimizerTests/disambiguator/if_statement.yul create mode 100644 test/libjulia/yulOptimizerTests/disambiguator/smoke.yul create mode 100644 test/libjulia/yulOptimizerTests/disambiguator/smoke_yul.yul create mode 100644 test/libjulia/yulOptimizerTests/disambiguator/switch_statement.yul create mode 100644 test/libjulia/yulOptimizerTests/disambiguator/variables.yul create mode 100644 test/libjulia/yulOptimizerTests/disambiguator/variables_clash.yul create mode 100644 test/libjulia/yulOptimizerTests/disambiguator/variables_inside_functions.yul diff --git a/test/libjulia/yulOptimizerTests/disambiguator/for_statement.yul b/test/libjulia/yulOptimizerTests/disambiguator/for_statement.yul new file mode 100644 index 000000000..0d2a38c58 --- /dev/null +++ b/test/libjulia/yulOptimizerTests/disambiguator/for_statement.yul @@ -0,0 +1,28 @@ +// yul +{ + { let a:u256, b:u256 } + { + for { let a:u256 } a { a := a } { + let b:u256 := a + } + } +} +// ---- +// disambiguator +// { +// { +// let a:u256, b:u256 +// } +// { +// for { +// let a_1:u256 +// } +// a_1 +// { +// a_1 := a_1 +// } +// { +// let b_1:u256 := a_1 +// } +// } +// } diff --git a/test/libjulia/yulOptimizerTests/disambiguator/funtion_call.yul b/test/libjulia/yulOptimizerTests/disambiguator/funtion_call.yul new file mode 100644 index 000000000..f917bb68e --- /dev/null +++ b/test/libjulia/yulOptimizerTests/disambiguator/funtion_call.yul @@ -0,0 +1,22 @@ +// yul +{ + { let a:u256, b:u256, c:u256, d:u256, f:u256 } + { + function f(a:u256) -> c:u256, d:u256 { + let b:u256, c_1:u256 := f(a) + } + } +} +// ---- +// disambiguator +// { +// { +// let a:u256, b:u256, c:u256, d:u256, f:u256 +// } +// { +// function f_1(a_1:u256) -> c_1:u256, d_1:u256 +// { +// let b_1:u256, c_1_1:u256 := f_1(a_1) +// } +// } +// } diff --git a/test/libjulia/yulOptimizerTests/disambiguator/if_statement.yul b/test/libjulia/yulOptimizerTests/disambiguator/if_statement.yul new file mode 100644 index 000000000..14f537579 --- /dev/null +++ b/test/libjulia/yulOptimizerTests/disambiguator/if_statement.yul @@ -0,0 +1,22 @@ +// yul +{ + { let a:u256, b:u256, c:u256 } + { + let a:bool + if a { let b:bool := a } + } +} +// ---- +// disambiguator +// { +// { +// let a:u256, b:u256, c:u256 +// } +// { +// let a_1:bool +// if a_1 +// { +// let b_1:bool := a_1 +// } +// } +// } diff --git a/test/libjulia/yulOptimizerTests/disambiguator/smoke.yul b/test/libjulia/yulOptimizerTests/disambiguator/smoke.yul new file mode 100644 index 000000000..d6cd8a619 --- /dev/null +++ b/test/libjulia/yulOptimizerTests/disambiguator/smoke.yul @@ -0,0 +1,5 @@ +{ } +// ---- +// disambiguator +// { +// } diff --git a/test/libjulia/yulOptimizerTests/disambiguator/smoke_yul.yul b/test/libjulia/yulOptimizerTests/disambiguator/smoke_yul.yul new file mode 100644 index 000000000..e55f4cd3e --- /dev/null +++ b/test/libjulia/yulOptimizerTests/disambiguator/smoke_yul.yul @@ -0,0 +1,6 @@ +// yul +{ } +// ---- +// disambiguator +// { +// } diff --git a/test/libjulia/yulOptimizerTests/disambiguator/switch_statement.yul b/test/libjulia/yulOptimizerTests/disambiguator/switch_statement.yul new file mode 100644 index 000000000..340ecccf8 --- /dev/null +++ b/test/libjulia/yulOptimizerTests/disambiguator/switch_statement.yul @@ -0,0 +1,27 @@ +// yul +{ + { let a:u256, b:u256, c:u256 } + { + let a:u256 + switch a + case 0:u256 { let b:u256 := a } + default { let c:u256 := a } + } +} +// ---- +// disambiguator +// { +// { +// let a:u256, b:u256, c:u256 +// } +// { +// let a_1:u256 +// switch a_1 +// case 0:u256 { +// let b_1:u256 := a_1 +// } +// default { +// let c_1:u256 := a_1 +// } +// } +// } diff --git a/test/libjulia/yulOptimizerTests/disambiguator/variables.yul b/test/libjulia/yulOptimizerTests/disambiguator/variables.yul new file mode 100644 index 000000000..65bd4c8f8 --- /dev/null +++ b/test/libjulia/yulOptimizerTests/disambiguator/variables.yul @@ -0,0 +1,12 @@ +// yul +{ { let a:u256 } { let a:u256 } } +// ---- +// disambiguator +// { +// { +// let a:u256 +// } +// { +// let a_1:u256 +// } +// } diff --git a/test/libjulia/yulOptimizerTests/disambiguator/variables_clash.yul b/test/libjulia/yulOptimizerTests/disambiguator/variables_clash.yul new file mode 100644 index 000000000..e462442a9 --- /dev/null +++ b/test/libjulia/yulOptimizerTests/disambiguator/variables_clash.yul @@ -0,0 +1,13 @@ +// yul +{ { let a:u256 let a_1:u256 } { let a:u256 } } +// ---- +// disambiguator +// { +// { +// let a:u256 +// let a_1:u256 +// } +// { +// let a_2:u256 +// } +// } diff --git a/test/libjulia/yulOptimizerTests/disambiguator/variables_inside_functions.yul b/test/libjulia/yulOptimizerTests/disambiguator/variables_inside_functions.yul new file mode 100644 index 000000000..e80959f69 --- /dev/null +++ b/test/libjulia/yulOptimizerTests/disambiguator/variables_inside_functions.yul @@ -0,0 +1,24 @@ +// yul +{ + { let c:u256 let b:u256 } + function f(a:u256, c:u256) -> b:u256 { let x:u256 } + { + let a:u256 let x:u256 + } +} +// ---- +// disambiguator +// { +// { +// let c:u256 +// let b:u256 +// } +// function f(a:u256, c_1:u256) -> b_1:u256 +// { +// let x:u256 +// } +// { +// let a_1:u256 +// let x_1:u256 +// } +// }