blob: 3353705755cec53e24380e357ffb0449a184f516 [file] [log] [blame]
// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.examples.sync;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.examples.ExamplesTestBase;
import com.android.tools.r8.utils.StringUtils;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class SyncTestRunner extends ExamplesTestBase {
public SyncTestRunner(TestParameters parameters) {
super(parameters);
}
@Override
public Class<?> getMainClass() {
return Sync.class;
}
@Override
public List<Class<?>> getTestClasses() throws Exception {
return ImmutableList.of(
getMainClass(),
Sync.Consumer.class,
Class.forName(getMainClass().getTypeName() + "$1"),
Class.forName(getMainClass().getTypeName() + "$2"),
Class.forName(getMainClass().getTypeName() + "$3"),
Class.forName(getMainClass().getTypeName() + "$4"),
Class.forName(getMainClass().getTypeName() + "$5"));
}
@Override
public String getExpected() {
List<String> lines = new ArrayList<>();
for (int i = 0; i < 10; i++) {
lines.add("static");
lines.add("end");
}
for (int i = 0; i < 10; i++) {
lines.add("instance");
lines.add("end");
}
for (int i = 0; i < 20; i++) {
lines.add("manual");
}
for (int i = 0; i < 10; i++) {
lines.add("trycatch");
lines.add("end");
}
lines.add("caught throw");
lines.add("caught throw");
return StringUtils.lines(lines);
}
@Test
@Override
public void testDebug() throws Exception {
// TODO(b/79671093): DEX has different line number info during stepping.
parameters.assumeCfRuntime();
super.testDebug();
}
}