Break out bytecodeText/conditions tests into smaller tests for if/while/do-while.

This commit is contained in:
Mark Punzalan
2019-03-14 21:55:11 -07:00
committed by max-kammerer
parent 9eb11ff3e9
commit 3585792b3b
26 changed files with 797 additions and 563 deletions
@@ -1,123 +0,0 @@
// Generates ICONST_1
val a = 1
fun main() {
// Negated == comparisons
// Generates IF_ICMPEQ and GOTO
if (!(a == 42)) {
"then"
} else {
"else"
}
// Generates IF_ICMPEQ and GOTO
while (!(a == 42)) {
"loop"
}
// Generates IF_ICMPNE
do {
"loop"
} while (!(a == 42))
// != comparisons
// Generates IF_ICMPEQ and GOTO
if (a != 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPEQ and GOTO
while (a != 42) {
"loop"
}
// Generates IF_ICMPNE
do {
"loop"
} while (a != 42)
// Negated > comparisons
// Generates IF_ICMPGT and GOTO
if (!(a > 42)) {
"then"
} else {
"else"
}
// Generates IF_ICMPGT and GOTO
while (!(a > 42)) {
"loop"
}
// Generates IF_ICMPLE
do {
"loop"
} while (!(a > 42))
// Negated >= comparisons
// Generates IF_ICMPGE and GOTO
if (!(a >= 42)) {
"then"
} else {
"else"
}
// Generates IF_ICMPGE and GOTO
while (!(a >= 42)) {
"loop"
}
// Generates IF_ICMPLT
do {
"loop"
} while (!(a >= 42))
// Negated < comparisons
// Generates IF_ICMPLT and GOTO
if (!(a < 42)) {
"then"
} else {
"else"
}
// Generates IF_ICMPLT and GOTO
while (!(a < 42)) {
"loop"
}
// Generates IF_ICMPGE
do {
"loop"
} while (!(a < 42))
// Negated <= comparisons
// Generates IF_ICMPLE and GOTO
if (!(a <= 42)) {
"then"
} else {
"else"
}
// Generates IF_ICMPLE and GOTO
while (!(a <= 42)) {
"loop"
}
// Generates IF_ICMPGT
do {
"loop"
} while (!(a <= 42))
}
//0 ICONST_0
//1 ICONST_1
//2 IF_ICMPNE
//4 IF_ICMPEQ
//3 IF_ICMPLE
//3 IF_ICMPLT
//3 IF_ICMPGE
//3 IF_ICMPGT
//18 IF
//12 GOTO
@@ -0,0 +1,44 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IF_ICMPNE
do {
"loop"
} while (!(a == 42))
// Generates IF_ICMPNE
do {
"loop"
} while (a != 42)
// Generates IF_ICMPLE
do {
"loop"
} while (!(a > 42))
// Generates IF_ICMPLT
do {
"loop"
} while (!(a >= 42))
// Generates IF_ICMPGE
do {
"loop"
} while (!(a < 42))
// Generates IF_ICMPGT
do {
"loop"
} while (!(a <= 42))
}
//0 ICONST_0
//1 ICONST_1
//2 IF_ICMPNE
//1 IF_ICMPLE
//1 IF_ICMPLT
//1 IF_ICMPGE
//1 IF_ICMPGT
//6 IF
//0 GOTO
@@ -0,0 +1,56 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IF_ICMPEQ and GOTO
if (!(a == 42)) {
"then"
} else {
"else"
}
// Generates IF_ICMPEQ and GOTO
if (a != 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPGT and GOTO
if (!(a > 42)) {
"then"
} else {
"else"
}
// Generates IF_ICMPGE and GOTO
if (!(a >= 42)) {
"then"
} else {
"else"
}
// Generates IF_ICMPLT and GOTO
if (!(a < 42)) {
"then"
} else {
"else"
}
// Generates IF_ICMPLE and GOTO
if (!(a <= 42)) {
"then"
} else {
"else"
}
}
//0 ICONST_0
//1 ICONST_1
//2 IF_ICMPEQ
//1 IF_ICMPLE
//1 IF_ICMPLT
//1 IF_ICMPGE
//1 IF_ICMPGT
//6 IF
//6 GOTO
@@ -0,0 +1,44 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IF_ICMPEQ and GOTO
while (!(a == 42)) {
"loop"
}
// Generates IF_ICMPEQ and GOTO
while (a != 42) {
"loop"
}
// Generates IF_ICMPGT and GOTO
while (!(a > 42)) {
"loop"
}
// Generates IF_ICMPGE and GOTO
while (!(a >= 42)) {
"loop"
}
// Generates IF_ICMPLT and GOTO
while (!(a < 42)) {
"loop"
}
// Generates IF_ICMPLE and GOTO
while (!(a <= 42)) {
"loop"
}
}
//0 ICONST_0
//1 ICONST_1
//2 IF_ICMPEQ
//1 IF_ICMPLE
//1 IF_ICMPLT
//1 IF_ICMPGE
//1 IF_ICMPGT
//6 IF
//6 GOTO
@@ -1,45 +0,0 @@
fun main(p: String?, p2: String?) {
// Negated == null comparisons
// Generates IFNULL and GOTO
if (!(p == null)) {
"then"
} else {
"else"
}
// Generates IFNULL and GOTO
while (!(p == null)) {
"loop"
}
// Generates IFNONNULL
do {
"loop"
} while (!(p == null))
// != null comparisons
// Generates IFNULL and GOTO
if (p2 != null) {
"then"
} else {
"else"
}
// Generates IFNULL and GOTO
while (p2 != null) {
"loop"
}
// Generates IFNONNULL
do {
"loop"
} while (p2 != null)
}
//0 ICONST_0
//0 ICONST_1
//0 ACONST_NULL
//4 IFNULL
//2 IFNONNULL
//6 IF
//4 GOTO
@@ -0,0 +1,18 @@
fun main(p: String?, p2: String?) {
// Generates IFNONNULL
do {
"loop"
} while (!(p == null))
// Generates IFNONNULL
do {
"loop"
} while (p2 != null)
}
//0 ICONST_0
//0 ICONST_1
//0 ACONST_NULL
//2 IFNONNULL
//2 IF
//0 GOTO
@@ -0,0 +1,22 @@
fun main(p: String?, p2: String?) {
// Generates IFNULL and GOTO
if (!(p == null)) {
"then"
} else {
"else"
}
// Generates IFNULL and GOTO
if (p2 != null) {
"then"
} else {
"else"
}
}
//0 ICONST_0
//0 ICONST_1
//0 ACONST_NULL
//2 IFNULL
//2 IF
//2 GOTO
@@ -0,0 +1,18 @@
fun main(p: String?, p2: String?) {
// Generates IFNULL and GOTO
while (!(p == null)) {
"loop"
}
// Generates IFNULL and GOTO
while (p2 != null) {
"loop"
}
}
//0 ICONST_0
//0 ICONST_1
//0 ACONST_NULL
//2 IFNULL
//2 IF
//2 GOTO
@@ -1,123 +0,0 @@
// Generates ICONST_1
val a = 1
fun main() {
// Negated == comparisons
// Generates IFEQ and GOTO
if (!(a == 0)) {
"then"
} else {
"else"
}
// Generates IFEQ and GOTO
while (!(a == 0)) {
"loop"
}
// Generates IFNE
do {
"loop"
} while (!(a == 0))
// != comparisons
// Generates IFEQ and GOTO
if (a != 0) {
"then"
} else {
"else"
}
// Generates IFEQ and GOTO
while (a != 0) {
"loop"
}
// Generates IFNE
do {
"loop"
} while (a != 0)
// Negated > comparisons
// Generates IFGT and GOTO
if (!(a > 0)) {
"then"
} else {
"else"
}
// Generates IFGT and GOTO
while (!(a > 0)) {
"loop"
}
// Generates IFLE
do {
"loop"
} while (!(a > 0))
// Negated >= comparisons
// Generates IFGE and GOTO
if (!(a >= 0)) {
"then"
} else {
"else"
}
// Generates IFGE and GOTO
while (!(a >= 0)) {
"loop"
}
// Generates IFLT
do {
"loop"
} while (!(a >= 0))
// Negated < comparisons
// Generates IFLT and GOTO
if (!(a < 0)) {
"then"
} else {
"else"
}
// Generates IFLT and GOTO
while (!(a < 0)) {
"loop"
}
// Generates IFGE
do {
"loop"
} while (!(a < 0))
// Negated <= comparisons
// Generates IFLE and GOTO
if (!(a <= 0)) {
"then"
} else {
"else"
}
// Generates IFLE and GOTO
while (!(a <= 0)) {
"loop"
}
// Generates IFGT
do {
"loop"
} while (!(a <= 0))
}
//0 ICONST_0
//1 ICONST_1
//2 IFNE
//4 IFEQ
//3 IFLE
//3 IFLT
//3 IFGE
//3 IFGT
//18 IF
//12 GOTO
@@ -0,0 +1,44 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IFNE
do {
"loop"
} while (!(a == 0))
// Generates IFNE
do {
"loop"
} while (a != 0)
// Generates IFLE
do {
"loop"
} while (!(a > 0))
// Generates IFLT
do {
"loop"
} while (!(a >= 0))
// Generates IFGE
do {
"loop"
} while (!(a < 0))
// Generates IFGT
do {
"loop"
} while (!(a <= 0))
}
//0 ICONST_0
//1 ICONST_1
//2 IFNE
//1 IFLE
//1 IFLT
//1 IFGE
//1 IFGT
//6 IF
//0 GOTO
@@ -0,0 +1,56 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IFEQ and GOTO
if (!(a == 0)) {
"then"
} else {
"else"
}
// Generates IFEQ and GOTO
if (a != 0) {
"then"
} else {
"else"
}
// Generates IFGT and GOTO
if (!(a > 0)) {
"then"
} else {
"else"
}
// Generates IFGE and GOTO
if (!(a >= 0)) {
"then"
} else {
"else"
}
// Generates IFLT and GOTO
if (!(a < 0)) {
"then"
} else {
"else"
}
// Generates IFLE and GOTO
if (!(a <= 0)) {
"then"
} else {
"else"
}
}
//0 ICONST_0
//1 ICONST_1
//2 IFEQ
//1 IFLE
//1 IFLT
//1 IFGE
//1 IFGT
//6 IF
//6 GOTO
@@ -0,0 +1,44 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IFEQ and GOTO
while (!(a == 0)) {
"loop"
}
// Generates IFEQ and GOTO
while (a != 0) {
"loop"
}
// Generates IFGT and GOTO
while (!(a > 0)) {
"loop"
}
// Generates IFGE and GOTO
while (!(a >= 0)) {
"loop"
}
// Generates IFLT and GOTO
while (!(a < 0)) {
"loop"
}
// Generates IFLE and GOTO
while (!(a <= 0)) {
"loop"
}
}
//0 ICONST_0
//1 ICONST_1
//2 IFEQ
//1 IFLE
//1 IFLT
//1 IFGE
//1 IFGT
//6 IF
//6 GOTO
@@ -1,105 +0,0 @@
// Generates ICONST_1
val a = 1
fun main() {
// == comparisons
// Generates IF_ICMPNE and GOTO
if (a == 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPNE and GOTO
while (a == 42) {
"loop"
}
// Generates IF_ICMPEQ
do {
"loop"
} while (a == 42)
// > comparisons
// Generates IF_ICMPLE and GOTO
if (a > 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPLE and GOTO
while (a > 42) {
"loop"
}
// Generates IF_ICMPGT
do {
"loop"
} while (a > 42)
// >= comparisons
// Generates IF_ICMPLT and GOTO
if (a >= 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPLT and GOTO
while (a >= 42) {
"loop"
}
// Generates IF_ICMPGE
do {
"loop"
} while (a >= 42)
// < comparisons
// Generates IF_ICMPGE and GOTO
if (a < 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPGE and GOTO
while (a < 42) {
"loop"
}
// Generates IF_ICMPLT
do {
"loop"
} while (a < 42)
// <= comparisons
// Generates IF_ICMPGT and GOTO
if (a <= 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPGT and GOTO
while (a <= 42) {
"loop"
}
// Generates IF_ICMPLE
do {
"loop"
} while (a <= 42)
}
//0 ICONST_0
//1 ICONST_1
//2 IF_ICMPNE
//1 IF_ICMPEQ
//3 IF_ICMPLE
//3 IF_ICMPLT
//3 IF_ICMPGE
//3 IF_ICMPGT
//15 IF
//10 GOTO
@@ -0,0 +1,39 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IF_ICMPEQ
do {
"loop"
} while (a == 42)
// Generates IF_ICMPGT
do {
"loop"
} while (a > 42)
// Generates IF_ICMPGE
do {
"loop"
} while (a >= 42)
// Generates IF_ICMPLT
do {
"loop"
} while (a < 42)
// Generates IF_ICMPLE
do {
"loop"
} while (a <= 42)
}
//0 ICONST_0
//1 ICONST_1
//1 IF_ICMPEQ
//1 IF_ICMPLE
//1 IF_ICMPLT
//1 IF_ICMPGE
//1 IF_ICMPGT
//5 IF
//0 GOTO
@@ -0,0 +1,49 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IF_ICMPNE and GOTO
if (a == 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPLE and GOTO
if (a > 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPLT and GOTO
if (a >= 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPGE and GOTO
if (a < 42) {
"then"
} else {
"else"
}
// Generates IF_ICMPGT and GOTO
if (a <= 42) {
"then"
} else {
"else"
}
}
//0 ICONST_0
//1 ICONST_1
//1 IF_ICMPNE
//1 IF_ICMPLE
//1 IF_ICMPLT
//1 IF_ICMPGE
//1 IF_ICMPGT
//5 IF
//5 GOTO
@@ -0,0 +1,39 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IF_ICMPNE and GOTO
while (a == 42) {
"loop"
}
// Generates IF_ICMPLE and GOTO
while (a > 42) {
"loop"
}
// Generates IF_ICMPLT and GOTO
while (a >= 42) {
"loop"
}
// Generates IF_ICMPGE and GOTO
while (a < 42) {
"loop"
}
// Generates IF_ICMPGT and GOTO
while (a <= 42) {
"loop"
}
}
//0 ICONST_0
//1 ICONST_1
//1 IF_ICMPNE
//1 IF_ICMPLE
//1 IF_ICMPLT
//1 IF_ICMPGE
//1 IF_ICMPGT
//5 IF
//5 GOTO
@@ -1,26 +0,0 @@
fun main(p: String?) {
// Generates IFNONNULL and GOTO
if (p == null) {
"then"
} else {
"else"
}
// Generates IFNONNULL and GOTO
while (p == null) {
"loop"
}
// Generates IFNULL
do {
"loop"
} while (p == null)
}
//0 ICONST_0
//0 ICONST_1
//0 ACONST_NULL
//2 IFNONNULL
//1 IFNULL
//3 IF
//2 GOTO
@@ -0,0 +1,13 @@
fun main(p: String?) {
// Generates IFNULL
do {
"loop"
} while (p == null)
}
//0 ICONST_0
//0 ICONST_1
//0 ACONST_NULL
//1 IFNULL
//1 IF
//0 GOTO
@@ -0,0 +1,15 @@
fun main(p: String?) {
// Generates IFNONNULL and GOTO
if (p == null) {
"then"
} else {
"else"
}
}
//0 ICONST_0
//0 ICONST_1
//0 ACONST_NULL
//1 IFNONNULL
//1 IF
//1 GOTO
@@ -0,0 +1,13 @@
fun main(p: String?) {
// Generates IFNONNULL and GOTO
while (p == null) {
"loop"
}
}
//0 ICONST_0
//0 ICONST_1
//0 ACONST_NULL
//1 IFNONNULL
//1 IF
//1 GOTO
@@ -1,105 +0,0 @@
// Generates ICONST_1
val a = 1
fun main() {
// == comparisons
// Generates IFNE and GOTO
if (a == 0) {
"then"
} else {
"else"
}
// Generates IFNE and GOTO
while (a == 0) {
"loop"
}
// Generates IFEQ
do {
"loop"
} while (a == 0)
// > comparisons
// Generates IFLE and GOTO
if (a > 0) {
"then"
} else {
"else"
}
// Generates IFLE and GOTO
while (a > 0) {
"loop"
}
// Generates IFGT
do {
"loop"
} while (a > 0)
// >= comparisons
// Generates IFLT and GOTO
if (a >= 0) {
"then"
} else {
"else"
}
// Generates IFLT and GOTO
while (a >= 0) {
"loop"
}
// Generates IFGE
do {
"loop"
} while (a >= 0)
// < comparisons
// Generates IFGE and GOTO
if (a < 0) {
"then"
} else {
"else"
}
// Generates IFGE and GOTO
while (a < 0) {
"loop"
}
// Generates IFLT
do {
"loop"
} while (a < 0)
// <= comparisons
// Generates IFGT and GOTO
if (a <= 0) {
"then"
} else {
"else"
}
// Generates IFGT and GOTO
while (a <= 0) {
"loop"
}
// Generates IFLE
do {
"loop"
} while (a <= 0)
}
//0 ICONST_0
//1 ICONST_1
//2 IFNE
//1 IFEQ
//3 IFLE
//3 IFLT
//3 IFGE
//3 IFGT
//15 IF
//10 GOTO
@@ -0,0 +1,39 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IFEQ
do {
"loop"
} while (a == 0)
// Generates IFGT
do {
"loop"
} while (a > 0)
// Generates IFGE
do {
"loop"
} while (a >= 0)
// Generates IFLT
do {
"loop"
} while (a < 0)
// Generates IFLE
do {
"loop"
} while (a <= 0)
}
//0 ICONST_0
//1 ICONST_1
//1 IFEQ
//1 IFLE
//1 IFLT
//1 IFGE
//1 IFGT
//5 IF
//0 GOTO
@@ -0,0 +1,49 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IFNE and GOTO
if (a == 0) {
"then"
} else {
"else"
}
// Generates IFLE and GOTO
if (a > 0) {
"then"
} else {
"else"
}
// Generates IFLT and GOTO
if (a >= 0) {
"then"
} else {
"else"
}
// Generates IFGE and GOTO
if (a < 0) {
"then"
} else {
"else"
}
// Generates IFGT and GOTO
if (a <= 0) {
"then"
} else {
"else"
}
}
//0 ICONST_0
//1 ICONST_1
//1 IFNE
//1 IFLE
//1 IFLT
//1 IFGE
//1 IFGT
//5 IF
//5 GOTO
@@ -0,0 +1,39 @@
// Generates ICONST_1
val a = 1
fun main() {
// Generates IFNE and GOTO
while (a == 0) {
"loop"
}
// Generates IFLE and GOTO
while (a > 0) {
"loop"
}
// Generates IFLT and GOTO
while (a >= 0) {
"loop"
}
// Generates IFGE and GOTO
while (a < 0) {
"loop"
}
// Generates IFGT and GOTO
while (a <= 0) {
"loop"
}
}
//0 ICONST_0
//1 ICONST_1
//1 IFNE
//1 IFLE
//1 IFLT
//1 IFGE
//1 IFGT
//5 IF
//5 GOTO