Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for javaonepointfive #1482

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
package com.ibm.wala.cast.java.test;

import com.ibm.wala.cast.java.client.ECJJavaSourceAnalysisEngine;
import com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
import com.ibm.wala.client.AbstractAnalysisEngine;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.util.CancelException;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import org.junit.jupiter.api.Test;

public class ECJJava15IRTest extends IRTests {

public ECJJava15IRTest() {
super(null);
dump = true;
}

@Override
protected AbstractAnalysisEngine<InstanceKey, CallGraphBuilder<InstanceKey>, ?> getAnalysisEngine(
final String[] mainClassDescriptors, Collection<String> sources, List<String> libs) {
JavaSourceAnalysisEngine engine =
new ECJJavaSourceAnalysisEngine() {
@Override
protected Iterable<Entrypoint> makeDefaultEntrypoints(IClassHierarchy cha) {
return Util.makeMainEntrypoints(
JavaSourceAnalysisScope.SOURCE, cha, mainClassDescriptors);
}
};
engine.setExclusionsFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
populateScope(engine, sources, libs);
return engine;
}

@Test
public void testVarargsOverriding()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testEnumSwitch()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testOverridesOnePointFour()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testVarargsCovariant()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testSimpleEnums()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testGenericSuperSink()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testAnonGeneNullarySimple() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testAnonymousGenerics() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testNotSoSimpleEnums() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testVarargs() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testGenericArrays() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testAnnotations() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}
}