001/* Run the Ptolemy model tests in the auto/knownFailedTests/ directory using cg C language code generation under JUnit.
002
003   Copyright (c) 2011-2016 The Regents of the University of California.
004   All rights reserved.
005   Permission is hereby granted, without written agreement and without
006   license or royalty fees, to use, copy, modify, and distribute this
007   software and its documentation for any purpose, provided that the above
008   copyright notice and the following two paragraphs appear in all copies
009   of this software.
010
011   IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
012   FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
013   ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
014   THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
015   SUCH DAMAGE.
016
017   THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
018   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
019   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
020   PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
021   CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
022   ENHANCEMENTS, OR MODIFICATIONS.
023
024   PT_COPYRIGHT_VERSION_2
025   COPYRIGHTENDKEY
026
027 */
028
029package ptolemy.util.test.junit;
030
031import org.junit.Before;
032import org.junit.Test;
033import org.junit.runner.RunWith;
034
035import junitparams.JUnitParamsRunner;
036import junitparams.Parameters;
037
038///////////////////////////////////////////////////////////////////
039//// AutoCGCKnownFailedTests
040
041/**
042 * Run the Ptolemy model tests in the auto/knownFailedTests directory
043 * using cg C language code generation under JUnit.
044 *
045 * <p> This test must be run from the directory that contains the
046 * auto/knowFailedTests/ directory, for example: </p>
047A *
048 * <pre>
049 * (cd $PTII/ptolemy/cg/adapter/generic/program/procedural/c/adapters/ptolemy/actor/lib/test; java -classpath ${PTII}:${PTII}/lib/junit-4.8.2.jar:${PTII}/lib/JUnitParams-0.3.0.jar org.junit.runner.JUnitCore ptolemy.util.test.junit.AutoCGCKnownFailedTests)
050 * </pre>
051 *
052 * <p>
053 * This test uses JUnitParams from
054 * <a href="http://code.google.com/p/junitparams/#in_browser">http://code.google.com/p/junitparams/</a>, which is released under
055 * <a href="http://www.apache.org/licenses/LICENSE-2.0#in_browser">Apache License 2.0</a>.
056 * </p>
057 *
058 * @author Christopher Brooks
059 * @version $Id$
060 * @since Ptolemy II 10.0
061 * @Pt.ProposedRating Red (cxh)
062 * @Pt.AcceptedRating Red (cxh)
063 */
064@RunWith(JUnitParamsRunner.class)
065public class AutoCGCKnownFailedTests extends AutoCGKnownFailedTests {
066
067    /**
068     * Find the ptolemy.cg.kernel.generic.GenericCodeGenerator class and its generateCode static
069     * method that takes an array of strings.
070     *
071     * @exception Throwable
072     *                If the class or constructor cannot be found.
073     */
074    @Override
075    @Before
076    public void setUp() throws Throwable {
077        super.setUp();
078    }
079
080    /**
081     * Generate, compile and run inline code for a model.
082     *
083     * @param fullPath The full path to the model file to be
084     * executed. If the fullPath ends with the value of the {@link
085     * #THERE_ARE_NO_AUTO_TESTS}, then the method returns
086     * immediately.
087     * @exception Throwable If thrown while executing the model.
088     */
089    @Test
090    @Parameters(method = "modelValues")
091    public void runModelInline(String fullPath) throws Throwable {
092        runModel(fullPath, "c", false /* generateInSubdirectory */,
093                true /* inline */, 2500 /* maximumLinesPerBlock */,
094                false /*variablesAsArrays*/, "" /*generatorPackageList*/);
095    }
096
097    /**
098     * Generate, compile and run non-inline code for a model.
099     *
100     * @param fullPath The full path to the model file to be
101     * executed. If the fullPath ends with the value of the {@link
102     * #THERE_ARE_NO_AUTO_TESTS}, then the method returns
103     * immediately.
104     * @exception Throwable If thrown while executing the model.
105     */
106    @Test
107    @Parameters(method = "modelValues")
108    public void runModelNoInline(String fullPath) throws Throwable {
109        runModel(fullPath, "c", false /* generateInSubdirectory */,
110                false /* inline */, 2500 /* maximumLinesPerBlock */,
111                false /*variablesAsArrays*/, "" /*generatorPackageList*/);
112    }
113}