Example usage for org.eclipse.jdt.core.tests.util AbstractCompilerTest F_1_4

List of usage examples for org.eclipse.jdt.core.tests.util AbstractCompilerTest F_1_4

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.tests.util AbstractCompilerTest F_1_4.

Prototype

int F_1_4

To view the source code for org.eclipse.jdt.core.tests.util AbstractCompilerTest F_1_4.

Click Source Link

Usage

From source file:de.fau.cs.i2.jamp.testsuite.TestAll.java

License:Open Source License

public static Test suite() {

    // Common test suites
    ArrayList standardTests = new ArrayList();

    // Tests to run when compliance is greater than 1.3
    ArrayList since_1_4 = new ArrayList();

    // Tests to run when compliance is greater than 1.4
    ArrayList since_1_5 = new ArrayList();

    // Tests to run when compliance is greater than 1.5
    ArrayList since_1_6 = new ArrayList();
    since_1_5.add(JampBarrierTest.class);
    since_1_5.add(JampCustomLoopSliceTest.class);
    since_1_5.add(JampFirstPrivateTest.class);
    since_1_5.add(JampForSemanticTest.class);
    since_1_5.add(JampForTest.class);
    since_1_5.add(JampIfTest.class);
    since_1_5.add(JampLockTest.class);
    since_1_5.add(JampMasterTest.class);
    since_1_5.add(JampParallelSyntaxTest.class);
    since_1_5.add(JampPrivateTest.class);
    since_1_5.add(JampReductionTest.class);
    since_1_5.add(JampScheduleTest.class);
    since_1_5.add(JampSectionsSyntaxTest.class);
    since_1_5.add(JampManagedTest.class);
    since_1_5.add(JampSpecification25Test.class);

    // Build final test suite
    TestSuite all = new TestSuite(TestAll.class.getName());
    int possibleComplianceLevels = AbstractCompilerTest.getPossibleComplianceLevels();
    if ((possibleComplianceLevels & AbstractCompilerTest.F_1_3) != 0) {
        ArrayList tests_1_3 = (ArrayList) standardTests.clone();
        // Reset forgotten subsets tests
        TestCase.TESTS_PREFIX = null;//from  w  w w  .  j ava 2  s .  c om
        TestCase.TESTS_NAMES = null;
        TestCase.TESTS_NUMBERS = null;
        TestCase.TESTS_RANGE = null;
        TestCase.RUN_ONLY_ID = null;
        all.addTest(
                AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_3, tests_1_3));
    }
    if ((possibleComplianceLevels & AbstractCompilerTest.F_1_4) != 0) {
        ArrayList tests_1_4 = (ArrayList) standardTests.clone();
        tests_1_4.addAll(since_1_4);
        // Reset forgotten subsets tests
        TestCase.TESTS_PREFIX = null;
        TestCase.TESTS_NAMES = null;
        TestCase.TESTS_NUMBERS = null;
        TestCase.TESTS_RANGE = null;
        TestCase.RUN_ONLY_ID = null;
        all.addTest(
                AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_4, tests_1_4));
    }
    if ((possibleComplianceLevels & AbstractCompilerTest.F_1_5) != 0) {
        ArrayList tests_1_5 = (ArrayList) standardTests.clone();
        tests_1_5.addAll(since_1_4);
        tests_1_5.addAll(since_1_5);
        // Reset forgotten subsets tests
        TestCase.TESTS_PREFIX = null;
        TestCase.TESTS_NAMES = null;
        TestCase.TESTS_NUMBERS = null;
        TestCase.TESTS_RANGE = null;
        TestCase.RUN_ONLY_ID = null;
        all.addTest(
                AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_5, tests_1_5));
    }
    if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) {
        ArrayList tests_1_6 = (ArrayList) standardTests.clone();
        tests_1_6.addAll(since_1_4);
        tests_1_6.addAll(since_1_5);
        tests_1_6.addAll(since_1_6);
        // Reset forgotten subsets tests
        TestCase.TESTS_PREFIX = null;
        TestCase.TESTS_NAMES = null;
        TestCase.TESTS_NUMBERS = null;
        TestCase.TESTS_RANGE = null;
        TestCase.RUN_ONLY_ID = null;
        all.addTest(
                AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_6, tests_1_6));
    }
    if ((possibleComplianceLevels & AbstractCompilerTest.F_1_7) != 0) {
        ArrayList tests_1_7 = (ArrayList) standardTests.clone();
        tests_1_7.addAll(since_1_4);
        tests_1_7.addAll(since_1_5);
        tests_1_7.addAll(since_1_6);
        // Reset forgotten subsets tests
        TestCase.TESTS_PREFIX = null;
        TestCase.TESTS_NAMES = null;
        TestCase.TESTS_NUMBERS = null;
        TestCase.TESTS_RANGE = null;
        TestCase.RUN_ONLY_ID = null;
        all.addTest(
                AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_7, tests_1_7));
    }
    return all;
}

From source file:org.eclipse.pde.api.tools.builder.tests.ApiTestingEnvironment.java

License:Open Source License

/**
 * Sets the given compliance on the given project.
 * /*w  w w.  j a v a2  s  .c om*/
 * @param project
 * @param compliance
 */
public void setProjectCompliance(IJavaProject project, String compliance) {
    int requiredComplianceFlag = 0;
    String compilerVersion = null;
    if (JavaCore.VERSION_1_4.equals(compliance)) {
        requiredComplianceFlag = AbstractCompilerTest.F_1_4;
        compilerVersion = JavaCore.VERSION_1_4;
    } else if (JavaCore.VERSION_1_5.equals(compliance)) {
        requiredComplianceFlag = AbstractCompilerTest.F_1_5;
        compilerVersion = JavaCore.VERSION_1_5;
    } else if (JavaCore.VERSION_1_6.equals(compliance)) {
        requiredComplianceFlag = AbstractCompilerTest.F_1_6;
        compilerVersion = JavaCore.VERSION_1_6;
    } else if (JavaCore.VERSION_1_7.equals(compliance)) {
        requiredComplianceFlag = AbstractCompilerTest.F_1_7;
        compilerVersion = JavaCore.VERSION_1_7;
    } else if (JavaCore.VERSION_1_8.equals(compliance)) {
        requiredComplianceFlag = AbstractCompilerTest.F_1_8;
        compilerVersion = JavaCore.VERSION_1_8;
    } else if (!JavaCore.VERSION_1_4.equals(compliance) && !JavaCore.VERSION_1_3.equals(compliance)) {
        throw new UnsupportedOperationException(
                "Test framework doesn't support compliance level: " + compliance); //$NON-NLS-1$
    }
    if (requiredComplianceFlag != 0) {
        if ((AbstractCompilerTest.getPossibleComplianceLevels() & requiredComplianceFlag) == 0) {
            throw new RuntimeException("This test requires a " + compliance + " JRE"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        HashMap<String, String> options = new HashMap<String, String>();
        options.put(JavaCore.COMPILER_COMPLIANCE, compilerVersion);
        options.put(JavaCore.COMPILER_SOURCE, compilerVersion);
        options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, compilerVersion);
        project.setOptions(options);
    }
}