aceunit-commit Mailing List for AceUnit (Page 4)
Status: Beta
Brought to you by:
christianhujer
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(139) |
Nov
(77) |
Dec
(32) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(55) |
Feb
(11) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(9) |
Oct
(75) |
Nov
(57) |
Dec
(21) |
2009 |
Jan
(14) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(24) |
Sep
(11) |
Oct
(1) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
(21) |
Mar
(10) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
From: <chr...@us...> - 2009-01-31 12:59:00
|
Revision: 508 http://aceunit.svn.sourceforge.net/aceunit/?rev=508&view=rev Author: christianhujer Date: 2009-01-31 12:58:51 +0000 (Sat, 31 Jan 2009) Log Message: ----------- Workaround bug in IntelliJ IDEA / encoding for properties files. Modified Paths: -------------- trunk/src/java/AceUnit.ipr Modified: trunk/src/java/AceUnit.ipr =================================================================== --- trunk/src/java/AceUnit.ipr 2009-01-31 12:37:07 UTC (rev 507) +++ trunk/src/java/AceUnit.ipr 2009-01-31 12:58:51 UTC (rev 508) @@ -53,7 +53,7 @@ <option name="ADDITIONAL_OPTIONS_STRING" value="" /> <option name="MAXIMUM_HEAP_SIZE" value="128" /> </component> - <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> + <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" defaultCharsetForPropertiesFiles="ISO-8859-1" /> <component name="EntryPointsManager"> <entry_points version="2.0" /> </component> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-31 12:55:21
|
Revision: 507 http://aceunit.svn.sourceforge.net/aceunit/?rev=507&view=rev Author: christianhujer Date: 2009-01-31 12:37:07 +0000 (Sat, 31 Jan 2009) Log Message: ----------- Implemented globally unique test ids. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java trunk/src/java/src/prj/net/sf/aceunit/GenTest.java trunk/src/java/src/prj/net/sf/aceunit/MethodList.java trunk/src/java/src/prj/net/sf/aceunit/TestCase.java trunk/src/native/test/common.mak Modified: trunk/src/java/src/prj/net/sf/aceunit/Fixture.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2009-01-11 21:08:12 UTC (rev 506) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2009-01-31 12:37:07 UTC (rev 507) @@ -27,9 +27,7 @@ package net.sf.aceunit; -import java.util.Arrays; -import java.util.Formatter; -import java.util.List; +import java.util.*; import java.io.File; import java.io.IOException; @@ -45,6 +43,11 @@ */ public class Fixture extends Suite { + /** The list of TestCases. + * Initially empty, filled by {@link #createTestCases(IdGenerator)}. + */ + private final List<TestCase> testCases = new ArrayList<TestCase>(); + /** The list of {@code @Test} methods. */ private final MethodList testMethods = MethodList.createTestMethodList(); @@ -162,10 +165,9 @@ out.format("/** The test case ids of this fixture. */%n"); out.format("static const TestCaseId_t testIds[] = {%n"); - int methodCount = 0; final String formatString = String.format(" %%%dd, /* %%s */%%n", (int) (Math.log10(testMethods.size()) + 1)); - for (final String method : testMethods) { - out.format(formatString, ++methodCount, method); + for (final TestCase testCase : testCases) { + out.format(formatString, testCase.getId(), testCase.getName()); } out.format("};%n"); out.format("%n"); @@ -249,4 +251,20 @@ return fixtureName + "Fixture"; } + /** Creates a TestCase for each contained test method. + * @param idGenerator IdGenerator for generating unique ids for the test cases. + */ + public void createTestCases(@NotNull final IdGenerator idGenerator) { + for (final String method : testMethods) { + testCases.add(new TestCase(idGenerator.getNextId(), method)); + } + } + + /** Returns an unmodifiable list of test cases. + * @return An unmodifiable list of test cases. + */ + public List<TestCase> getTestCases() { + return Collections.unmodifiableList(testCases); + } + } // class MethodLists Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2009-01-11 21:08:12 UTC (rev 506) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2009-01-31 12:37:07 UTC (rev 507) @@ -1,4 +1,4 @@ -/* Copyright (c) 2007 - 2008, Christian Hujer +/* Copyright (c) 2007 - 2009, Christian Hujer * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,6 +31,8 @@ import java.io.IOException; import java.util.List; import java.util.EnumSet; +import java.util.Map; +import java.util.HashMap; import net.sf.japi.io.args.ArgParser; import net.sf.japi.io.args.BasicCommand; @@ -72,6 +74,9 @@ @NotNull private final IdGenerator idGenerator = new IdGenerator(); + /** The table of all tests. */ + private final Map<Integer, String> allTests = new HashMap<Integer, String>(); + /** * Creates a GenTest instance. * @@ -176,6 +181,7 @@ } final String hSource = pckg.getCode("foo"); SourceFiles.writeIfChanged(cFile, hSource, force); + allTests.put(pckg.getId(), pckgDir.toString().replaceAll("[^\\/]", ".")); } if (containedFixture && parent != null) { parent.addSuite(pckg); @@ -200,6 +206,12 @@ final Fixture fixture = new Fixture(idGenerator.getNextId(), fixtureFile); final boolean containedFixture = fixture.containsTests(); if (containedFixture) { + fixture.createTestCases(idGenerator); + for (final TestCase testCase : fixture.getTestCases()) { + final Integer id = testCase.getId(); + assert !allTests.containsKey(id) : "IDs must be unique, especially within allTests."; + allTests.put(testCase.getId(), testCase.getName()); + } final File hFile = new File(fixtureFile.getParent(), fixtureName + ".h"); if (printSet.contains(Print.sources) || printSet.contains(Print.fixtures)) { System.out.println(fixtureFile); @@ -210,6 +222,7 @@ final String hSource = fixture.getCode(fixtureName); SourceFiles.writeIfChanged(hFile, hSource, force); pckg.addSuite(fixture); + allTests.put(fixture.getId(), fixtureFile.toString().replaceAll("[^\\/]", ".")); } return containedFixture; } Modified: trunk/src/java/src/prj/net/sf/aceunit/MethodList.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2009-01-11 21:08:12 UTC (rev 506) +++ trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2009-01-31 12:37:07 UTC (rev 507) @@ -32,7 +32,6 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; -import java.util.Formatter; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -65,9 +64,6 @@ @NotNull protected final List<String> methodNames = new ArrayList<String>(); - /** The arguments of the annotations. */ - @NotNull private final List<String> annotParams = new ArrayList<String>(); - /** The unmodifiable view of {@link #methodNames}. */ @NotNull private final Collection<String> unmodifiableMethodNames = Collections.unmodifiableCollection(methodNames); Modified: trunk/src/java/src/prj/net/sf/aceunit/TestCase.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/TestCase.java 2009-01-11 21:08:12 UTC (rev 506) +++ trunk/src/java/src/prj/net/sf/aceunit/TestCase.java 2009-01-31 12:37:07 UTC (rev 507) @@ -26,18 +26,33 @@ */ package net.sf.aceunit; +import org.jetbrains.annotations.NotNull; + /** A TestCase. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public class TestCase extends Test { + /** The name of this TestCase. */ + @NotNull private final String name; + /** * Creates a TestCase. * * @param id Id for this TestCase. + * @param name Name for this TestCase. */ - protected TestCase(final int id) { + protected TestCase(final int id, @NotNull final String name) { super(id); + this.name = name; } + /** Returns the name of this TestCase. + * @return The name of this TestCase. + */ + @NotNull + public String getName() { + return name; + } + } Modified: trunk/src/native/test/common.mak =================================================================== --- trunk/src/native/test/common.mak 2009-01-11 21:08:12 UTC (rev 506) +++ trunk/src/native/test/common.mak 2009-01-31 12:37:07 UTC (rev 507) @@ -9,7 +9,7 @@ VPATH=$(ACEUNIT_NATIVE_PATH) -GENERATED:=$(shell java -jar $(ACEUNIT_JAVA_PATH)/AceUnit.jar --print=generated .) +GENERATED:=$(shell java -ea -jar $(ACEUNIT_JAVA_PATH)/AceUnit.jar --print=generated .) SUITES:=$(filter *.c,$(GENERATED)) CSOURCES:=$(sort $(shell find . -name "*.c")) $(SUITES) CXXSOURCES:=$(sort $(shell find . -name "*.cpp")) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-11 21:08:16
|
Revision: 506 http://aceunit.svn.sourceforge.net/aceunit/?rev=506&view=rev Author: christianhujer Date: 2009-01-11 21:08:12 +0000 (Sun, 11 Jan 2009) Log Message: ----------- Added class TestCase. Added Paths: ----------- trunk/src/java/src/prj/net/sf/aceunit/TestCase.java Added: trunk/src/java/src/prj/net/sf/aceunit/TestCase.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/TestCase.java (rev 0) +++ trunk/src/java/src/prj/net/sf/aceunit/TestCase.java 2009-01-11 21:08:12 UTC (rev 506) @@ -0,0 +1,43 @@ +/* Copyright (c) 2007 - 2009, Christian Hujer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the AceUnit developers nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.sf.aceunit; + +/** A TestCase. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class TestCase extends Test { + + /** + * Creates a TestCase. + * + * @param id Id for this TestCase. + */ + protected TestCase(final int id) { + super(id); + } + +} Property changes on: trunk/src/java/src/prj/net/sf/aceunit/TestCase.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-11 21:02:52
|
Revision: 505 http://aceunit.svn.sourceforge.net/aceunit/?rev=505&view=rev Author: christianhujer Date: 2009-01-11 21:02:49 +0000 (Sun, 11 Jan 2009) Log Message: ----------- Introduced abstract class Test as preparation of a TestCase class which shares the same id space with Suite / Pckg. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/Suite.java Added Paths: ----------- trunk/src/java/src/prj/net/sf/aceunit/Test.java Modified: trunk/src/java/src/prj/net/sf/aceunit/Suite.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Suite.java 2009-01-11 21:01:36 UTC (rev 504) +++ trunk/src/java/src/prj/net/sf/aceunit/Suite.java 2009-01-11 21:02:49 UTC (rev 505) @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, Christian Hujer +/* Copyright (c) 2007 - 2009, Christian Hujer * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,30 +36,18 @@ * * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public abstract class Suite { +public abstract class Suite extends Test { - /** The id of this Suite. */ - private final int id; - /** * Creates a Suite. * * @param id Id for this Suite. */ protected Suite(final int id) { - this.id = id; + super(id); } /** - * Returns the id of this Suite. - * - * @return The id of this Suite. - */ - public int getId() { - return id; - } - - /** * Returns the global variable name of this Suite. * @return The global variable name of this Suite. */ Added: trunk/src/java/src/prj/net/sf/aceunit/Test.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Test.java (rev 0) +++ trunk/src/java/src/prj/net/sf/aceunit/Test.java 2009-01-11 21:02:49 UTC (rev 505) @@ -0,0 +1,55 @@ +/* Copyright (c) 2007 - 2009, Christian Hujer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the AceUnit developers nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.sf.aceunit; + +/** A test, which can be anything that actually is a Test. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public abstract class Test { + + /** The id of this Suite. */ + private final int id; + + /** + * Creates a Test. + * + * @param id Id for this Test. + */ + protected Test(final int id) { + this.id = id; + } + + /** + * Returns the id of this Test. + * + * @return The id of this Test. + */ + public int getId() { + return id; + } + +} Property changes on: trunk/src/java/src/prj/net/sf/aceunit/Test.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-11 21:01:44
|
Revision: 504 http://aceunit.svn.sourceforge.net/aceunit/?rev=504&view=rev Author: christianhujer Date: 2009-01-11 21:01:36 +0000 (Sun, 11 Jan 2009) Log Message: ----------- Updated project files to IntelliJ IDEA 8.0.1. Modified Paths: -------------- trunk/src/java/AceUnit.iml trunk/src/java/AceUnit.ipr Modified: trunk/src/java/AceUnit.iml =================================================================== --- trunk/src/java/AceUnit.iml 2009-01-11 20:23:07 UTC (rev 503) +++ trunk/src/java/AceUnit.iml 2009-01-11 21:01:36 UTC (rev 504) @@ -35,7 +35,6 @@ <SOURCES /> </library> </orderEntry> - <orderEntryProperties /> </component> <component name="copyright"> <Base> Modified: trunk/src/java/AceUnit.ipr =================================================================== --- trunk/src/java/AceUnit.ipr 2009-01-11 20:23:07 UTC (rev 503) +++ trunk/src/java/AceUnit.ipr 2009-01-11 21:01:36 UTC (rev 504) @@ -53,6 +53,7 @@ <option name="ADDITIONAL_OPTIONS_STRING" value="" /> <option name="MAXIMUM_HEAP_SIZE" value="128" /> </component> + <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> <component name="EntryPointsManager"> <entry_points version="2.0" /> </component> @@ -75,9 +76,17 @@ <profile version="1.0" is_locked="false"> <option name="myName" value="Project Default" /> <option name="myLocal" value="false" /> + <inspection_tool class="PublicField" level="WARNING" enabled="true"> + <option name="ignoreEnums" value="false" /> + </inspection_tool> </profile> </profiles> - <list size="0" /> + <list size="4"> + <item index="0" class="java.lang.String" itemvalue="SERVER PROBLEM" /> + <item index="1" class="java.lang.String" itemvalue="INFO" /> + <item index="2" class="java.lang.String" itemvalue="WARNING" /> + <item index="3" class="java.lang.String" itemvalue="ERROR" /> + </list> </component> <component name="JavacSettings"> <option name="DEBUGGING_INFO" value="true" /> @@ -232,6 +241,9 @@ </item> </group> </component> + <component name="ProjectDetails"> + <option name="projectName" value="AceUnit" /> + </component> <component name="ProjectFileVersion" converted="true" /> <component name="ProjectModuleManager"> <modules> @@ -250,7 +262,7 @@ </option> <option name="lastEditedConfigurable" value="Project 'Default (Template) Project'" /> </component> - <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="latest" project-jdk-type="JavaSDK"> + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="latest" project-jdk-type="JavaSDK"> <output url="file://$PROJECT_DIR$/classes" /> </component> <component name="ResourceManagerContainer"> @@ -272,6 +284,9 @@ <SplitterProportionsDataImpl /> </option> </component> + <component name="SvnBranchConfigurationManager"> + <option name="myVersion" value="124" /> + </component> <component name="VcsDirectoryMappings"> <mapping directory="" vcs="svn" /> </component> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-11 20:23:10
|
Revision: 503 http://aceunit.svn.sourceforge.net/aceunit/?rev=503&view=rev Author: christianhujer Date: 2009-01-11 20:23:07 +0000 (Sun, 11 Jan 2009) Log Message: ----------- Finished implementation of running selected tests. (Untested, tests follow soon.) Modified Paths: -------------- trunk/src/native/AceUnit.c Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2009-01-11 20:22:46 UTC (rev 502) +++ trunk/src/native/AceUnit.c 2009-01-11 20:23:07 UTC (rev 503) @@ -242,6 +242,116 @@ } #ifdef ACEUNIT_SUITES +/** Runs the specified test cases from a test fixture. + * @param fixture Test fixture to run. + * @param tests Tests to run. + * @param group Group to run. + */ +void runFixtureIfSpecified(const TestFixture_t *const fixture, const AceTestId_t *const tests +#ifdef ACEUNIT_GROUP + , AceGroupId_t group +#endif + ) { +#define invokeAll(X) for (secondary = fixture->X; NULL != *secondary; secondary++) {\ + (*secondary)();\ +} +#define globalLog(X, Y) if ((NULL != globalLogger) && (NULL != globalLogger->X)) {\ + globalLogger->X(Y);\ +} + const testMethod_t *secondary; /* beforeClass, before, after, afterClass */ + const testMethod_t *testCase; + const TestCaseId_t *testId; +#ifdef ACEUNIT_LOOP + const aceunit_loop_t *loopMax; + aceunit_loop_t currentLoop; +#endif +#ifdef ACEUNIT_GROUP + const AceGroupId_t *groups; +#endif + bool ranBeforeClass = false; + +#ifdef ACEUNIT_LOG_FIXTURE + globalLog(fixtureStarted, fixture->id); +#endif + for ( + testCase = fixture->testCase, +#ifdef ACEUNIT_LOOP + loopMax = fixture->loops, +#endif +#ifdef ACEUNIT_GROUP + groups = fixture->groups, +#endif + testId = fixture->testIds; + NULL != *testCase; + testCase++, +#ifdef ACEUNIT_LOOP + loopMax++, +#endif +#ifdef ACEUNIT_GROUP + groups++, +#endif + testId++ + ) { + if (containsTests(tests, *testId)) { +#ifdef ACEUNIT_GROUP + if (*groups == group) { +#endif + if (!ranBeforeClass) { + ACEUNIT_PRE_BEFORECLASS + invokeAll(beforeClass); + ACEUNIT_POST_BEFORECLASS + ranBeforeClass = true; + } + runnerData->currentTestId = *testId; +#ifdef ACEUNIT_LOG_TESTCASE + globalLog(testCaseStarted, runnerData->currentTestId); +#endif + ACEUNIT_PRE_BEFORE + invokeAll(before); + ACEUNIT_POST_BEFORE + runnerData->recentError = NULL; + ACEUNIT_PRE_TEST +#if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP + if (0 == setjmp(aceunitJmpBuf)) { +#endif +#ifdef ACEUNIT_LOOP + for (currentLoop = 0; (currentLoop < *loopMax) && (NULL == runnerData->recentError); currentLoop++) { +#endif + (*testCase)(); +#ifdef ACEUNIT_LOOP + } +#endif +#if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP + } +#endif + ACEUNIT_POST_TEST + runnerData->testCaseCount++; + if (NULL != runnerData->recentError) { + globalLog(testCaseFailed, runnerData->recentError); + runnerData->testCaseFailureCount++; + } + ACEUNIT_PRE_AFTER + invokeAll(after); + ACEUNIT_POST_AFTER +#ifdef ACEUNIT_LOG_TESTCASE + globalLog(testCaseEnded, runnerData->currentTestId); +#endif + runnerData->currentTestId = TestCaseId_NULL; +#ifdef ACEUNIT_GROUP + } +#endif + } + } + ACEUNIT_PRE_AFTERCLASS + invokeAll(afterClass); + ACEUNIT_POST_AFTERCLASS +#ifdef ACEUNIT_LOG_FIXTURE + globalLog(fixtureEnded, fixture->id); +#endif +#undef invokeAll +#undef globalLog +} + /** Runs all test cases from the supplied suite. * @param suite Test suite to run. * @param group Group to run. @@ -331,7 +441,7 @@ } } else { /** this is a Fixture */ - runFixtureIfSpecified((TestFixture_t *) suite + runFixtureIfSpecified((TestFixture_t *) suite, tests #ifdef ACEUNIT_GROUP , group #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-11 20:22:56
|
Revision: 502 http://aceunit.svn.sourceforge.net/aceunit/?rev=502&view=rev Author: christianhujer Date: 2009-01-11 20:22:46 +0000 (Sun, 11 Jan 2009) Log Message: ----------- Made the definition of ALL_TESTS more independent of the actual type used for it. Modified Paths: -------------- trunk/src/native/AceUnit.h Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2009-01-11 20:05:20 UTC (rev 501) +++ trunk/src/native/AceUnit.h 2009-01-11 20:22:46 UTC (rev 502) @@ -427,7 +427,7 @@ * The value is all bits set. * This value can be used in #AceTestId_t values. */ -#define ALL_TESTS ((AceTestId_t) 0xFFFF) +#define ALL_TESTS ((AceTestId_t) -1) /** GroupId_t specifies a group. */ typedef uint16_t AceGroupId_t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-11 20:05:25
|
Revision: 501 http://aceunit.svn.sourceforge.net/aceunit/?rev=501&view=rev Author: christianhujer Date: 2009-01-11 20:05:20 +0000 (Sun, 11 Jan 2009) Log Message: ----------- Fixed minor compilation issues with new code. Modified Paths: -------------- trunk/src/native/AceUnit.c Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2009-01-09 06:28:09 UTC (rev 500) +++ trunk/src/native/AceUnit.c 2009-01-11 20:05:20 UTC (rev 501) @@ -54,6 +54,7 @@ runnerData->recentError->testId = runnerData->currentTestId; } +#ifdef ACEUNIT_SUITES /** Returns if the specified test id is contained in a list of test ids. * * @note Always returns \c true if \p tests contains the value #ALL_TESTS. @@ -73,6 +74,7 @@ } return false; } +#endif /** The Logger. */ extern TestLogger_t *globalLogger; @@ -299,9 +301,7 @@ suites++; } } -#endif -#if 0 /** This always is the first suite. */ extern TestSuite_t suite1; @@ -323,7 +323,7 @@ if (suites != NULL) { /* this is not a Fixture. */ for (; NULL != *suites; suites++) { - runTestsIfSpecified(*suites + runTestsIfSpecified(*suites, tests #ifdef ACEUNIT_GROUP ,group #endif @@ -354,7 +354,7 @@ * @param tests tests to run, terminated with zero. */ void runTests(const AceTestId_t *const tests) { - runTestsIfSpecified(suite1, tests); + runTestsIfSpecified(&suite1, tests); } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-09 06:28:22
|
Revision: 500 http://aceunit.svn.sourceforge.net/aceunit/?rev=500&view=rev Author: christianhujer Date: 2009-01-09 06:28:09 +0000 (Fri, 09 Jan 2009) Log Message: ----------- Commit of intermediate state of work on running specific tests. Modified Paths: -------------- trunk/src/native/AceUnit.c Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2009-01-09 06:27:04 UTC (rev 499) +++ trunk/src/native/AceUnit.c 2009-01-09 06:28:09 UTC (rev 500) @@ -54,6 +54,26 @@ runnerData->recentError->testId = runnerData->currentTestId; } +/** Returns if the specified test id is contained in a list of test ids. + * + * @note Always returns \c true if \p tests contains the value #ALL_TESTS. + * + * @param tests Tests in which to look for \p testId, terminated by #NO_TEST. + * @param testId Test id for which to look. + * @return Whether \p testId is contained in \p tests or not. + * @retval true if \p testId is contained in \p tests. + * @retval true if \p tests contains #ALL_TESTS. + * @retval false otherwise + */ +static bool containsTests(const AceTestId_t *tests, const AceTestId_t test) { + for (;NO_TEST != *tests; tests++) { + if ((test == *tests) || (ALL_TESTS == *tests)) { + return true; + } + } + return false; +} + /** The Logger. */ extern TestLogger_t *globalLogger; @@ -282,14 +302,59 @@ #endif #if 0 +/** This always is the first suite. */ +extern TestSuite_t suite1; + /** Runs the specified tests. + * + * @param suite Suite or fixture at which the test runner currently is at. + * @param tests Tests to run, terminated by #NO_TEST. + * @param group Group to run. + */ +void runTestsIfSpecified(const TestSuite_t *const suite, const AceTestId_t *const tests +#ifdef ACEUNIT_GROUP + , AceUnitGroupid_t group +#endif +) { + if (containsTests(tests, suite->id)) { + runSuite(suite); + } else { + const TestSuite_t *const *suites = suite->suites; + if (suites != NULL) { + /* this is not a Fixture. */ + for (; NULL != *suites; suites++) { + runTestsIfSpecified(*suites +#ifdef ACEUNIT_GROUP + ,group +#endif + ); + } + } else { + /** this is a Fixture */ + runFixtureIfSpecified((TestFixture_t *) suite +#ifdef ACEUNIT_GROUP + , group +#endif + ); + } + } +} + +/** Runs the specified tests. * All tests (test cases and suites - fixtures as well as packages) share the same number space. * With other words, the number for a test case is unique (within where you run AceUnit.jar). * That means you can specify test suites, fixtures or tests. + * + * @note Each test will be executed only zero or one times, even if \p tests contains duplicates. + * Duplicates may be explicit or implicit. + * Explicit duplicates means the same test id is specified more than once. + * Implicit duplicates means the same test id is specified indirectly twice. + * Indirect specification of a test id is not via its test id but via its fixture or suite id. + * * @param tests tests to run, terminated with zero. */ -void runTests(AceTestId_t *tests) { - /* TODO not implemented yet - design and tests not finished. */ +void runTests(const AceTestId_t *const tests) { + runTestsIfSpecified(suite1, tests); } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-09 06:27:14
|
Revision: 499 http://aceunit.svn.sourceforge.net/aceunit/?rev=499&view=rev Author: christianhujer Date: 2009-01-09 06:27:04 +0000 (Fri, 09 Jan 2009) Log Message: ----------- Defined constants for AceTestId_t. Modified Paths: -------------- trunk/src/native/AceUnit.h Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2009-01-09 05:01:24 UTC (rev 498) +++ trunk/src/native/AceUnit.h 2009-01-09 06:27:04 UTC (rev 499) @@ -417,6 +417,18 @@ /** TestId_t specifies a test. */ typedef uint16_t AceTestId_t; +/** Special value for #AceTestId_t that specifies no test. + * The value is zero. + * This value can be used to terminate vectors of #AceTestId_t values. + */ +#define NO_TEST ((AceTestId_t) 0) + +/** Special value for #AceTestId_t that specifies all tests. + * The value is all bits set. + * This value can be used in #AceTestId_t values. + */ +#define ALL_TESTS ((AceTestId_t) 0xFFFF) + /** GroupId_t specifies a group. */ typedef uint16_t AceGroupId_t; @@ -507,6 +519,8 @@ */ typedef struct TestSuite_tt { + /* Implementation note: Take care that the beginning of TestSuite_t is identical to that of TestFixture_t! */ + /** The Id of this suite. */ SuiteId_t const id; @@ -563,7 +577,7 @@ #endif #ifdef ACEUNIT_GROUP - /** The test cases that shall be looped. */ + /** The test groups to which each test case belongs. */ const AceGroupId_t *const groups; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-09 05:01:30
|
Revision: 498 http://aceunit.svn.sourceforge.net/aceunit/?rev=498&view=rev Author: christianhujer Date: 2009-01-09 05:01:24 +0000 (Fri, 09 Jan 2009) Log Message: ----------- Documented default behaviour if ACEUNIT_C_MODE is not set. Modified Paths: -------------- trunk/src/native/AceUnit.h Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2008-12-19 18:54:57 UTC (rev 497) +++ trunk/src/native/AceUnit.h 2009-01-09 05:01:24 UTC (rev 498) @@ -45,7 +45,7 @@ * </dd> * <dt><code>ACEUNIT_C_MODE</code></dt> * <dd> - * Set this macro to specify how AceUnit shall interact with the compiler environment regarding header files. + * Set this macro to explicitely specify how AceUnit shall interact with the compiler environment regarding header files. * The following options are possible: * <dl> * <dt><code>ACEUNIT_C_MODE_C99_INCLUDES</code> (default in a C99 environment)</dt> @@ -60,6 +60,9 @@ * But it's a shame that even today, about a decade after the release of C99, still only a small minority of compilers actually properly support that standard. * <p> * Note: this replaces ACEUNIT_INTERNAL_ISO_TYPES and ACEUNIT_SKIP_ISO_DEFINES from previous versions of AceUnit. + * <p> + * Note: If you do not set this macro, AceUnit will make the decision itself. + * The default is to assume ACEUNIT_C_MODE_C99_INCLUDES for a C99 environment, ACEUNIT_C_MODE_C89 otherwise. * </dd> * <dt><code>ACEUNIT_STATIC_ANNOTATIONS</code></dt> * <dd> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-19 18:55:02
|
Revision: 497 http://aceunit.svn.sourceforge.net/aceunit/?rev=497&view=rev Author: christianhujer Date: 2008-12-19 18:54:57 +0000 (Fri, 19 Dec 2008) Log Message: ----------- Further increased make performance. Modified Paths: -------------- trunk/src/native/test/common.mak Modified: trunk/src/native/test/common.mak =================================================================== --- trunk/src/native/test/common.mak 2008-12-19 18:54:36 UTC (rev 496) +++ trunk/src/native/test/common.mak 2008-12-19 18:54:57 UTC (rev 497) @@ -2,10 +2,10 @@ CVERSION?=c89 MAIN?=RunTests -ACEUNIT_NATIVE_PATH=../.. -ACEUNIT_JAVA_PATH=../../../java -ACEUNIT_JAVA_SRC=$(shell find $(ACEUNIT_JAVA_PATH)/src -name "*.java") -ACEUNIT_PARTS=AceUnit AceUnitData $(LOGGER) +ACEUNIT_NATIVE_PATH:=../.. +ACEUNIT_JAVA_PATH:=../../../java +ACEUNIT_JAVA_SRC:=$(shell find $(ACEUNIT_JAVA_PATH)/src -name "*.java") +ACEUNIT_PARTS:=AceUnit AceUnitData $(LOGGER) VPATH=$(ACEUNIT_NATIVE_PATH) @@ -17,14 +17,14 @@ DEPENDS:=$(OBJECTS:.o=.d) LINTOUTS:=$(OBJECTS:.o=.ln) -LINT=splint +LINT:=splint -CPPFLAGS=-DACEUNIT_CONFIG_FILE=\"AceUnitConfig.h\" -I . -I $(ACEUNIT_NATIVE_PATH) -C_and_LD_FLAGS=-fprofile-arcs +CPPFLAGS:=-DACEUNIT_CONFIG_FILE=\"AceUnitConfig.h\" -I . -I $(ACEUNIT_NATIVE_PATH) +C_and_LD_FLAGS:=-fprofile-arcs CFLAGS?=-fdiagnostics-show-option -std=$(CVERSION) -pedantic $(C_and_LD_FLAGS) -ftest-coverage -W -Wall -g CXXFLAGS?=-fdiagnostics-show-option -pedantic $(C_and_LD_FLAGS) -ftest-coverage -W -Wall -g -LDFLAGS=$(C_and_LD_FLAGS) -LINTFLAGS=-badflag -weak +LDFLAGS?=$(C_and_LD_FLAGS) +LINTFLAGS?=-badflag -weak .PHONY : all clean coverage lint test This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-19 18:54:42
|
Revision: 496 http://aceunit.svn.sourceforge.net/aceunit/?rev=496&view=rev Author: christianhujer Date: 2008-12-19 18:54:36 +0000 (Fri, 19 Dec 2008) Log Message: ----------- Increased group test complexity. Modified Paths: -------------- trunk/src/native/test/group/GroupTest.c trunk/src/native/test/group/RunTests.c Modified: trunk/src/native/test/group/GroupTest.c =================================================================== --- trunk/src/native/test/group/GroupTest.c 2008-12-19 15:51:40 UTC (rev 495) +++ trunk/src/native/test/group/GroupTest.c 2008-12-19 18:54:36 UTC (rev 496) @@ -48,3 +48,11 @@ A_Group(1) A_Test void secondTestInGroup1() { printf("Second test in group 1.\n"); } + +A_Group(2) A_Test void firstTestInGroup2() { + printf("First test in group 2.\n"); +} + +A_Group(2) A_Test void secondTestInGroup2() { + printf("Second test in group 2.\n"); +} Modified: trunk/src/native/test/group/RunTests.c =================================================================== --- trunk/src/native/test/group/RunTests.c 2008-12-19 15:51:40 UTC (rev 495) +++ trunk/src/native/test/group/RunTests.c 2008-12-19 18:54:36 UTC (rev 496) @@ -49,5 +49,6 @@ int retVal = 0; runFixture(&GroupTestFixture, 0); runFixture(&GroupTestFixture, 1); + runFixture(&GroupTestFixture, 2); return retVal; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-19 15:51:46
|
Revision: 495 http://aceunit.svn.sourceforge.net/aceunit/?rev=495&view=rev Author: christianhujer Date: 2008-12-19 15:51:40 +0000 (Fri, 19 Dec 2008) Log Message: ----------- Improved performance of make. Modified Paths: -------------- trunk/src/native/test/common.mak Modified: trunk/src/native/test/common.mak =================================================================== --- trunk/src/native/test/common.mak 2008-12-05 09:24:46 UTC (rev 494) +++ trunk/src/native/test/common.mak 2008-12-19 15:51:40 UTC (rev 495) @@ -10,12 +10,12 @@ VPATH=$(ACEUNIT_NATIVE_PATH) GENERATED:=$(shell java -jar $(ACEUNIT_JAVA_PATH)/AceUnit.jar --print=generated .) -SUITES=$(filter *.c,$(GENERATED)) -CSOURCES=$(sort $(shell find . -name "*.c")) $(SUITES) -CXXSOURCES=$(sort $(shell find . -name "*.cpp")) -OBJECTS=$(CSOURCES:.c=.o) $(CXXSOURCES:.cpp=.o) $(addsuffix .o,$(ACEUNIT_PARTS)) $(addsuffix .o,$(MAIN)) -DEPENDS=$(OBJECTS:.o=.d) -LINTOUTS=$(OBJECTS:.o=.ln) +SUITES:=$(filter *.c,$(GENERATED)) +CSOURCES:=$(sort $(shell find . -name "*.c")) $(SUITES) +CXXSOURCES:=$(sort $(shell find . -name "*.cpp")) +OBJECTS:=$(CSOURCES:.c=.o) $(CXXSOURCES:.cpp=.o) $(addsuffix .o,$(ACEUNIT_PARTS)) $(addsuffix .o,$(MAIN)) +DEPENDS:=$(OBJECTS:.o=.d) +LINTOUTS:=$(OBJECTS:.o=.ln) LINT=splint This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-05 09:24:48
|
Revision: 494 http://aceunit.svn.sourceforge.net/aceunit/?rev=494&view=rev Author: christianhujer Date: 2008-12-05 09:24:46 +0000 (Fri, 05 Dec 2008) Log Message: ----------- Replaced C++ comments with C89 comments. Modified Paths: -------------- trunk/src/native/AceUnit.h trunk/src/native/AceUnitData.h trunk/src/native/AceUnitPrintf.c Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2008-12-04 23:14:18 UTC (rev 493) +++ trunk/src/native/AceUnit.h 2008-12-05 09:24:46 UTC (rev 494) @@ -280,7 +280,7 @@ #endif #endif #elif ACEUNIT_C_MODE == ACEUNIT_C_MODE_PROPRIETARY -// no definitions for proprietary mode +/* no definitions for proprietary mode */ #else #error Unknown value for ACEUNIT_C_MODE #endif Modified: trunk/src/native/AceUnitData.h =================================================================== --- trunk/src/native/AceUnitData.h 2008-12-04 23:14:18 UTC (rev 493) +++ trunk/src/native/AceUnitData.h 2008-12-05 09:24:46 UTC (rev 494) @@ -71,7 +71,7 @@ #endif #ifdef ACEUNIT_RUNNERDATA_EXTENSION - // Extension hook to add your own fields to AceUnitRunnerData_t. + /* Extension hook to add your own fields to AceUnitRunnerData_t. */ ACEUNIT_RUNNERDATA_EXTENSION #endif Modified: trunk/src/native/AceUnitPrintf.c =================================================================== --- trunk/src/native/AceUnitPrintf.c 2008-12-04 23:14:18 UTC (rev 493) +++ trunk/src/native/AceUnitPrintf.c 2008-12-05 09:24:46 UTC (rev 494) @@ -117,7 +117,7 @@ break; case 'X': upperCase = true; - //-fallthrough + /*-fallthrough*/ case 'x': case 'p': { @@ -134,7 +134,7 @@ } break; default: - // Unknown format or flag, simply ignore it. + /* Unknown format or flag, simply ignore it. */ } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-04 23:14:21
|
Revision: 493 http://aceunit.svn.sourceforge.net/aceunit/?rev=493&view=rev Author: christianhujer Date: 2008-12-04 23:14:18 +0000 (Thu, 04 Dec 2008) Log Message: ----------- Improved documentation. Modified Paths: -------------- trunk/src/native/AceUnitAssert.h trunk/src/native/Doxyfile Modified: trunk/src/native/AceUnitAssert.h =================================================================== --- trunk/src/native/AceUnitAssert.h 2008-12-04 23:06:40 UTC (rev 492) +++ trunk/src/native/AceUnitAssert.h 2008-12-04 23:14:18 UTC (rev 493) @@ -31,6 +31,11 @@ #include "AceUnit.h" +/** AceUnit assertions. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @file AceUnitAssert.h + */ + #ifdef ACEUNIT_EXPLICIT_MESSAGES #include <stdio.h> /* for snprintf(). */ #endif Modified: trunk/src/native/Doxyfile =================================================================== --- trunk/src/native/Doxyfile 2008-12-04 23:06:40 UTC (rev 492) +++ trunk/src/native/Doxyfile 2008-12-04 23:14:18 UTC (rev 493) @@ -847,7 +847,7 @@ # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = NO +GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-04 23:06:42
|
Revision: 492 http://aceunit.svn.sourceforge.net/aceunit/?rev=492&view=rev Author: christianhujer Date: 2008-12-04 23:06:40 +0000 (Thu, 04 Dec 2008) Log Message: ----------- Added cplusplus2 tests to Makefile. Modified Paths: -------------- trunk/src/native/test/Makefile Modified: trunk/src/native/test/Makefile =================================================================== --- trunk/src/native/test/Makefile 2008-12-04 22:54:43 UTC (rev 491) +++ trunk/src/native/test/Makefile 2008-12-04 23:06:40 UTC (rev 492) @@ -3,8 +3,9 @@ basicEmbedded \ comment \ cplusplus \ + cplusplus2 \ exhand \ - explicitMsg/ \ + explicitMsg \ group \ longjmp \ loop \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-04 22:54:48
|
Revision: 491 http://aceunit.svn.sourceforge.net/aceunit/?rev=491&view=rev Author: christianhujer Date: 2008-12-04 22:54:43 +0000 (Thu, 04 Dec 2008) Log Message: ----------- Added another test for C++. Modified Paths: -------------- trunk/src/native/test/common.mak Added Paths: ----------- trunk/src/native/test/cplusplus2/ trunk/src/native/test/cplusplus2/AceUnitConfig.h trunk/src/native/test/cplusplus2/AceUnitTest.c trunk/src/native/test/cplusplus2/AceUnitTest2.cpp trunk/src/native/test/cplusplus2/Makefile Modified: trunk/src/native/test/common.mak =================================================================== --- trunk/src/native/test/common.mak 2008-12-04 22:53:56 UTC (rev 490) +++ trunk/src/native/test/common.mak 2008-12-04 22:54:43 UTC (rev 491) @@ -11,8 +11,9 @@ GENERATED:=$(shell java -jar $(ACEUNIT_JAVA_PATH)/AceUnit.jar --print=generated .) SUITES=$(filter *.c,$(GENERATED)) -SOURCES=$(sort $(shell find . -name "*.c")) $(SUITES) -OBJECTS=$(SOURCES:.c=.o) $(addsuffix .o,$(ACEUNIT_PARTS)) $(addsuffix .o,$(MAIN)) +CSOURCES=$(sort $(shell find . -name "*.c")) $(SUITES) +CXXSOURCES=$(sort $(shell find . -name "*.cpp")) +OBJECTS=$(CSOURCES:.c=.o) $(CXXSOURCES:.cpp=.o) $(addsuffix .o,$(ACEUNIT_PARTS)) $(addsuffix .o,$(MAIN)) DEPENDS=$(OBJECTS:.o=.d) LINTOUTS=$(OBJECTS:.o=.ln) @@ -21,6 +22,7 @@ CPPFLAGS=-DACEUNIT_CONFIG_FILE=\"AceUnitConfig.h\" -I . -I $(ACEUNIT_NATIVE_PATH) C_and_LD_FLAGS=-fprofile-arcs CFLAGS?=-fdiagnostics-show-option -std=$(CVERSION) -pedantic $(C_and_LD_FLAGS) -ftest-coverage -W -Wall -g +CXXFLAGS?=-fdiagnostics-show-option -pedantic $(C_and_LD_FLAGS) -ftest-coverage -W -Wall -g LDFLAGS=$(C_and_LD_FLAGS) LINTFLAGS=-badflag -weak Added: trunk/src/native/test/cplusplus2/AceUnitConfig.h =================================================================== --- trunk/src/native/test/cplusplus2/AceUnitConfig.h (rev 0) +++ trunk/src/native/test/cplusplus2/AceUnitConfig.h 2008-12-04 22:54:43 UTC (rev 491) @@ -0,0 +1,6 @@ +/** Use return to exit a test case with a failed assertion. */ +#define ACEUNIT_ASSERTION_STYLE ACEUNIT_ASSERTION_STYLE_RETURN + +#define ACEUNIT_SUITES + +#define TEST_CASES_FOR_VERIFICATION 8 Property changes on: trunk/src/native/test/cplusplus2/AceUnitConfig.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/native/test/cplusplus2/AceUnitTest.c =================================================================== --- trunk/src/native/test/cplusplus2/AceUnitTest.c (rev 0) +++ trunk/src/native/test/cplusplus2/AceUnitTest.c 2008-12-04 22:54:43 UTC (rev 491) @@ -0,0 +1,58 @@ +/* Copyright (c) 2007, Christian Hujer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the AceUnit developers nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** Unit Test for AceUnit. + * Yes, AceUnit can be tested using itself. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @file AceUnitTest.c + */ + +#include <stdbool.h> +#include <stdio.h> + +#include "AceUnit.h" + +class Foo { + public: + static void test1(void); + static void test2(void); + static void test3(void); +}; + +#include "AceUnitTest.h" + +A_Test void Foo::test1(void) { +} + +A_Test void Foo::test2(void) { +} + +A_Test void Foo::test3(void) { +} + +A_Test void test4(void) { +} Property changes on: trunk/src/native/test/cplusplus2/AceUnitTest.c ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/native/test/cplusplus2/AceUnitTest2.cpp =================================================================== --- trunk/src/native/test/cplusplus2/AceUnitTest2.cpp (rev 0) +++ trunk/src/native/test/cplusplus2/AceUnitTest2.cpp 2008-12-04 22:54:43 UTC (rev 491) @@ -0,0 +1,58 @@ +/* Copyright (c) 2007, Christian Hujer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the AceUnit developers nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** Unit Test for AceUnit. + * Yes, AceUnit can be tested using itself. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @file AceUnitTest.c + */ + +#include <stdbool.h> +#include <stdio.h> + +#include "AceUnit.h" + +class Bar { + public: + static void test5(void); + static void test6(void); + static void test7(void); +}; + +#include "AceUnitTest2.h" + +A_Test void Bar::test5(void) { +} + +A_Test void Bar::test6(void) { +} + +A_Test void Bar::test7(void) { +} + +A_Test void test8(void) { +} Property changes on: trunk/src/native/test/cplusplus2/AceUnitTest2.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/native/test/cplusplus2/Makefile =================================================================== --- trunk/src/native/test/cplusplus2/Makefile (rev 0) +++ trunk/src/native/test/cplusplus2/Makefile 2008-12-04 22:54:43 UTC (rev 491) @@ -0,0 +1,6 @@ +# It looks strange defining CC to a C++ compiler, but that's intentional: +# This testcase tests if AceUnit also works fine if somebody uses a C++ compiler to compile AceUnit C code. +CC=$(CXX) +CFLAGS=-fdiagnostics-show-option -pedantic $(C_and_LD_FLAGS) -ftest-coverage -W -Wall -g +MAIN=AceUnitMain +include ../common.mak Property changes on: trunk/src/native/test/cplusplus2/Makefile ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-04 22:54:00
|
Revision: 490 http://aceunit.svn.sourceforge.net/aceunit/?rev=490&view=rev Author: christianhujer Date: 2008-12-04 22:53:56 +0000 (Thu, 04 Dec 2008) Log Message: ----------- The generator now supports .cpp files and knows not to generate prototypes for C++ class member methods. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java trunk/src/java/src/prj/net/sf/aceunit/GenTest.java trunk/src/java/src/prj/net/sf/aceunit/SourceFiles.java Modified: trunk/src/java/src/prj/net/sf/aceunit/Fixture.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-12-03 22:20:09 UTC (rev 489) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-12-04 22:53:56 UTC (rev 490) @@ -88,7 +88,7 @@ public Fixture(final int id, @NotNull final File file) throws IOException { super(id); findMethods(SourceFiles.readSourceWithoutComments(file)); - this.fixtureName = file.getName().replaceAll("\\.c$", ""); + this.fixtureName = file.getName().replaceAll("\\.c(pp)?$", ""); } /** @@ -153,7 +153,9 @@ out.format("/* The prototypes are here to be able to include this header file at the beginning of the test file instead of at the end. */%n"); for (final MethodList methods1 : usedMethodLists) { for (final String method : methods1) { - out.format("%s void %s(void);%n", methods1.getAnnotation(), method); + if (!method.contains("::")) { + out.format("%s void %s(void);%n", methods1.getAnnotation(), method); + } } } out.format("%n"); Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2008-12-03 22:20:09 UTC (rev 489) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2008-12-04 22:53:56 UTC (rev 490) @@ -114,7 +114,7 @@ */ private boolean perform(@NotNull final String basename) throws IOException { final File baseDir = new File(basename); - final File fixtureFile = new File(basename + ".c"); + final File[] fixtureFiles = { new File(basename + ".c"), new File(basename + ".cpp") }; boolean baseFound = false; boolean testsFound = false; if (baseDir.isDirectory()) { @@ -125,17 +125,20 @@ System.err.println(baseDir + ": warning: No test cases found. Maybe the annotations are missing?"); } } - if (fixtureFile.isFile()) { - baseFound = true; - final boolean testsFoundInFile = performFixture(fixtureFile.getParentFile(), new Pckg(0), fixtureFile); - testsFound |= testsFoundInFile; - if (!testsFoundInFile) { - System.err.println(fixtureFile + ": warning: No test cases found. Maybe the annotations are missing?"); + for (final File fixtureFile : fixtureFiles) { + if (fixtureFile.isFile()) { + baseFound = true; + final boolean testsFoundInFile = performFixture(fixtureFile.getParentFile(), new Pckg(0), fixtureFile); + testsFound |= testsFoundInFile; + if (!testsFoundInFile) { + System.err.println(fixtureFile + ": warning: No test cases found. Maybe the annotations are missing?"); + } } } if (!baseFound) { System.err.println("AceUnit: " + basename + ": error: No such directory."); System.err.println("AceUnit: " + basename + ".c: error: No such file."); + System.err.println("AceUnit: " + basename + ".cpp: error: No such file."); System.err.println("AceUnit: no input files"); } if (!testsFound) { @@ -163,6 +166,9 @@ for (final File fixtureFile : pckgDir.listFiles(SourceFiles.C_SOURCE_FILTER)) { containedFixture |= performFixture(base, pckg, fixtureFile); } + for (final File fixtureFile : pckgDir.listFiles(SourceFiles.CPP_SOURCE_FILTER)) { + containedFixture |= performFixture(base, pckg, fixtureFile); + } if (containedFixture) { final File cFile = new File(pckgDir, "Suite" + pckg.getId() + ".c"); if (printSet.contains(Print.sources) || printSet.contains(Print.suites) || printSet.contains(Print.generated)) { @@ -190,7 +196,7 @@ if (fixtureFile.getName().matches("Suite\\d+\\.c")) { return false; } - final String fixtureName = fixtureFile.getName().replaceAll("\\.c$", ""); + final String fixtureName = fixtureFile.getName().replaceAll("\\.c(pp)?$", ""); final Fixture fixture = new Fixture(idGenerator.getNextId(), fixtureFile); final boolean containedFixture = fixture.containsTests(); if (containedFixture) { Modified: trunk/src/java/src/prj/net/sf/aceunit/SourceFiles.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/SourceFiles.java 2008-12-03 22:20:09 UTC (rev 489) +++ trunk/src/java/src/prj/net/sf/aceunit/SourceFiles.java 2008-12-04 22:53:56 UTC (rev 490) @@ -62,6 +62,14 @@ } }; + /** FileFilter to get C++ source files. */ + public static final FileFilter CPP_SOURCE_FILTER = new FileFilter() { + /** {@inheritDoc} */ + public boolean accept(final File pathname) { + return pathname.isFile() && pathname.getName().endsWith(".cpp"); + } + }; + /** * Flag to remember whether we've already warned the user about 1.6 being required for removing a write protection from a file. * We do not want to spam the user with the same message over and over again. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-03 22:20:11
|
Revision: 489 http://aceunit.svn.sourceforge.net/aceunit/?rev=489&view=rev Author: christianhujer Date: 2008-12-03 22:20:09 +0000 (Wed, 03 Dec 2008) Log Message: ----------- Disabled unfinished function to remove warnings. Modified Paths: -------------- trunk/src/native/AceUnit.c Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2008-12-03 21:50:28 UTC (rev 488) +++ trunk/src/native/AceUnit.c 2008-12-03 22:20:09 UTC (rev 489) @@ -281,6 +281,7 @@ } #endif +#if 0 /** Runs the specified tests. * All tests (test cases and suites - fixtures as well as packages) share the same number space. * With other words, the number for a test case is unique (within where you run AceUnit.jar). @@ -290,6 +291,7 @@ void runTests(AceTestId_t *tests) { /* TODO not implemented yet - design and tests not finished. */ } +#endif /* TODO: Add method to run specified test cases from a test fixture. * This should be done by a linear search through the list of test cases. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-03 21:50:30
|
Revision: 488 http://aceunit.svn.sourceforge.net/aceunit/?rev=488&view=rev Author: christianhujer Date: 2008-12-03 21:50:28 +0000 (Wed, 03 Dec 2008) Log Message: ----------- Removed unnecessary conditioning of running after. Modified Paths: -------------- trunk/src/native/AceUnit.c Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2008-12-03 21:19:57 UTC (rev 487) +++ trunk/src/native/AceUnit.c 2008-12-03 21:50:28 UTC (rev 488) @@ -180,11 +180,9 @@ globalLog(testCaseFailed, runnerData->recentError); runnerData->testCaseFailureCount++; } - if (ranBeforeClass) { - ACEUNIT_PRE_AFTER - invokeAll(after); - ACEUNIT_POST_AFTER - } + ACEUNIT_PRE_AFTER + invokeAll(after); + ACEUNIT_POST_AFTER #ifdef ACEUNIT_LOG_TESTCASE globalLog(testCaseEnded, runnerData->currentTestId); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-03 21:19:59
|
Revision: 487 http://aceunit.svn.sourceforge.net/aceunit/?rev=487&view=rev Author: christianhujer Date: 2008-12-03 21:19:57 +0000 (Wed, 03 Dec 2008) Log Message: ----------- Improved doxygen documentation. Modified Paths: -------------- trunk/src/native/AceUnit.h trunk/src/native/Doxyfile Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2008-12-03 21:16:31 UTC (rev 486) +++ trunk/src/native/AceUnit.h 2008-12-03 21:19:57 UTC (rev 487) @@ -590,21 +590,23 @@ /** Runs all test cases from a test fixture. * @param fixture Test fixture to run. * @param group Group to run. + * This parameter is only available if #ACEUNIT_GROUP is defined. */ -extern void runFixture(const TestFixture_t *const fixture -#ifdef ACEUNIT_GROUP - , AceGroupId_t group +#if defined(ACEUNIT_GROUP) || defined(DOXYGEN) +extern void runFixture(const TestFixture_t *const fixture, AceGroupId_t group); +#else +extern void runFixture(const TestFixture_t *const fixture); #endif -); /** Runs all test cases from a test suite. * @param suite Test suite to run. * @param group Group to run. + * This parameter is only available if #ACEUNIT_GROUP is defined. */ -extern void runSuite(const TestSuite_t *const suite -#ifdef ACEUNIT_GROUP - , AceGroupId_t group +#if defined(ACEUNIT_GROUP) || defined(DOXYGEN) +extern void runSuite(const TestSuite_t *const suite, AceGroupId_t group); +#else +extern void runSuite(const TestSuite_t *const suite); #endif -); #endif /* ACEUNIT_H */ Modified: trunk/src/native/Doxyfile =================================================================== --- trunk/src/native/Doxyfile 2008-12-03 21:16:31 UTC (rev 486) +++ trunk/src/native/Doxyfile 2008-12-03 21:19:57 UTC (rev 487) @@ -1115,7 +1115,7 @@ # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = +PREDEFINED = DOXYGEN # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-03 21:16:34
|
Revision: 486 http://aceunit.svn.sourceforge.net/aceunit/?rev=486&view=rev Author: christianhujer Date: 2008-12-03 21:16:31 +0000 (Wed, 03 Dec 2008) Log Message: ----------- Changed code of runFixture() to be more readable (preparation for future refactorings). Modified Paths: -------------- trunk/src/native/AceUnit.c Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2008-12-03 20:41:26 UTC (rev 485) +++ trunk/src/native/AceUnit.c 2008-12-03 21:16:31 UTC (rev 486) @@ -61,6 +61,39 @@ jmp_buf aceunitJmpBuf; #endif +/* Define the PRE/POST macros as empty macros in case they are undefined to make further source code more readable. */ +#ifndef ACEUNIT_PRE_BEFORECLASS +#define ACEUNIT_PRE_BEFORECLASS +#endif +#ifndef ACEUNIT_POST_BEFORECLASS +#define ACEUNIT_POST_BEFORECLASS +#endif +#ifndef ACEUNIT_PRE_BEFORE +#define ACEUNIT_PRE_BEFORE +#endif +#ifndef ACEUNIT_POST_BEFORE +#define ACEUNIT_POST_BEFORE +#endif +#ifndef ACEUNIT_PRE_TEST +#define ACEUNIT_PRE_TEST +#endif +#ifndef ACEUNIT_POST_TEST +#define ACEUNIT_POST_TEST +#endif +#ifndef ACEUNIT_PRE_AFTER +#define ACEUNIT_PRE_AFTER +#endif +#ifndef ACEUNIT_POST_AFTER +#define ACEUNIT_POST_AFTER +#endif +#ifndef ACEUNIT_PRE_AFTERCLASS +#define ACEUNIT_PRE_AFTERCLASS +#endif +#ifndef ACEUNIT_POST_AFTERCLASS +#define ACEUNIT_POST_AFTERCLASS +#endif + + /** Runs all test cases from a test fixture. * @param fixture Test fixture to run. * @param group Group to run. @@ -114,30 +147,20 @@ if (*groups == group) { #endif if (!ranBeforeClass) { -#ifdef ACEUNIT_PRE_BEFORECLASS ACEUNIT_PRE_BEFORECLASS -#endif invokeAll(beforeClass); -#ifdef ACEUNIT_POST_BEFORECLASS ACEUNIT_POST_BEFORECLASS -#endif ranBeforeClass = true; } runnerData->currentTestId = *testId; #ifdef ACEUNIT_LOG_TESTCASE globalLog(testCaseStarted, runnerData->currentTestId); #endif -#ifdef ACEUNIT_PRE_BEFORE ACEUNIT_PRE_BEFORE -#endif invokeAll(before); -#ifdef ACEUNIT_POST_BEFORE ACEUNIT_POST_BEFORE -#endif runnerData->recentError = NULL; -#ifdef ACEUNIT_PRE_TEST ACEUNIT_PRE_TEST -#endif #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP if (0 == setjmp(aceunitJmpBuf)) { #endif @@ -151,22 +174,16 @@ #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP } #endif -#ifdef ACEUNIT_POST_TEST ACEUNIT_POST_TEST -#endif runnerData->testCaseCount++; if (NULL != runnerData->recentError) { globalLog(testCaseFailed, runnerData->recentError); runnerData->testCaseFailureCount++; } if (ranBeforeClass) { -#ifdef ACEUNIT_PRE_AFTER ACEUNIT_PRE_AFTER -#endif invokeAll(after); -#ifdef ACEUNIT_POST_AFTER ACEUNIT_POST_AFTER -#endif } #ifdef ACEUNIT_LOG_TESTCASE globalLog(testCaseEnded, runnerData->currentTestId); @@ -176,13 +193,9 @@ } #endif } -#ifdef ACEUNIT_PRE_AFTERCLASS ACEUNIT_PRE_AFTERCLASS -#endif invokeAll(afterClass); -#ifdef ACEUNIT_POST_AFTERCLASS ACEUNIT_POST_AFTERCLASS -#endif #ifdef ACEUNIT_LOG_FIXTURE globalLog(fixtureEnded, fixture->id); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-03 20:41:28
|
Revision: 485 http://aceunit.svn.sourceforge.net/aceunit/?rev=485&view=rev Author: christianhujer Date: 2008-12-03 20:41:26 +0000 (Wed, 03 Dec 2008) Log Message: ----------- [2383702] Runner does not properly execute @BeforeClass methods Modified Paths: -------------- trunk/src/native/AceUnit.c Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2008-12-03 09:30:44 UTC (rev 484) +++ trunk/src/native/AceUnit.c 2008-12-03 20:41:26 UTC (rev 485) @@ -86,7 +86,7 @@ #ifdef ACEUNIT_GROUP const AceGroupId_t *groups; #endif - bool ranBeforeClass; + bool ranBeforeClass = false; #ifdef ACEUNIT_LOG_FIXTURE globalLog(fixtureStarted, fixture->id); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-12-03 09:30:48
|
Revision: 484 http://aceunit.svn.sourceforge.net/aceunit/?rev=484&view=rev Author: christianhujer Date: 2008-12-03 09:30:44 +0000 (Wed, 03 Dec 2008) Log Message: ----------- Inlined generated source formatting as preparation of using a template engine. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java trunk/src/java/src/prj/net/sf/aceunit/MethodList.java Modified: trunk/src/java/src/prj/net/sf/aceunit/Fixture.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-12-03 09:08:48 UTC (rev 483) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-12-03 09:30:44 UTC (rev 484) @@ -150,30 +150,64 @@ out.format("#include \"AceUnit.h\"%n"); out.format("%n"); - out.format("%s%n", getPrototypes()); + out.format("/* The prototypes are here to be able to include this header file at the beginning of the test file instead of at the end. */%n"); + for (final MethodList methods1 : usedMethodLists) { + for (final String method : methods1) { + out.format("%s void %s(void);%n", methods1.getAnnotation(), method); + } + } + out.format("%n"); - out.format("%s%n", getTestMethodIds()); - out.format("%s%n", getTestLoops()); - out.format("%s%n", getTestGroups()); + out.format("/** The test case ids of this fixture. */%n"); + out.format("static const TestCaseId_t testIds[] = {%n"); + int methodCount = 0; + final String formatString = String.format(" %%%dd, /* %%s */%%n", (int) (Math.log10(testMethods.size()) + 1)); + for (final String method : testMethods) { + out.format(formatString, ++methodCount, method); + } + out.format("};%n"); + out.format("%n"); - for (final MethodList methods : usedMethodLists) { - out.format("%s%n", methods.getFunctionPointerList()); + out.format("#ifndef ACEUNIT_EMBEDDED%n"); + out.format("/** The test names of this fixture. */%n"); + out.format("static const char *const testNames[] = {%n"); + for (final String method : testMethods) { + out.format(" \"%s\",%n", method); } + out.format("};%n"); + out.format("#endif%n"); + out.format("%n"); - out.format("%s%n", getFixture(basename)); + out.format("#ifdef ACEUNIT_LOOP%n"); + out.format("/** The loops of this fixture. */%n"); + out.format("static const aceunit_loop_t loops[] = {%n"); + for (final String method : testMethods) { + out.format(" %s,%n", loopMethods.getArg(method)); // TODO Care about last comma? + } + out.format("};%n"); + out.format("#endif%n"); + out.format("%n"); + out.format("#ifdef ACEUNIT_GROUP%n"); + out.format("/** The groups of this fixture. */%n"); + out.format("static const AceGroupId_t groups[] = {%n"); + for (final String method : testMethods) { + out.format(" %s,%n", groupMethods.getArg(method)); // TODO Care about last comma? + } + out.format("};%n"); + out.format("#endif%n"); + out.format("%n"); - out.format("#endif /* _%s_H */%n", ucaseFixture); - return out.toString(); - } + for (final MethodList methods : usedMethodLists) { + out.format("/** The %s of this fixture. */%n", methods.getTitle()); + out.format("static const testMethod_t %s[] = {%n", methods.getSymName()); + for (final String method : methods) { + out.format(" %s,%n", method); + } + out.format(" NULL%n"); + out.format("};%n"); + out.format("%n"); + } - /** - * Returns source code for the fixture. - * - * @param basename Base name of the fixture. - * @return Source code for the fixture. - */ - public String getFixture(@NotNull final String basename) { - final Formatter out = new Formatter(); out.format("/** This fixture. */%n"); out.format("#if defined __cplusplus%n"); out.format("extern%n"); @@ -202,22 +236,9 @@ out.format(" beforeClass,%n"); out.format(" afterClass%n"); out.format("};%n"); - return out.toString(); - } + out.format("%n"); - /** - * Returns source code for all method prototypes. - * - * @return Source code for all method prototypes. - */ - public String getPrototypes() { - final Formatter out = new Formatter(); - out.format("/* The prototypes are here to be able to include this header file at the beginning of the test file instead of at the end. */%n"); - for (final MethodList methods : usedMethodLists) { - for (final String method : methods) { - out.format("%s void %s(void);%n", methods.getAnnotation(), method); - } - } + out.format("#endif /* _%s_H */%n", ucaseFixture); return out.toString(); } @@ -226,63 +247,4 @@ return fixtureName + "Fixture"; } - /** - * Returns a String with the source code for the test method ids. - * - * @return Source code for the test method ids. - */ - public String getTestMethodIds() { - final Formatter out = new Formatter(); - out.format("/** The test case ids of this fixture. */%n"); - out.format("static const TestCaseId_t testIds[] = {%n"); - int methodCount = 0; - final String formatString = String.format(" %%%dd, /* %%s */%%n", (int) (Math.log10(testMethods.size()) + 1)); - for (final String method : testMethods) { - out.format(formatString, ++methodCount, method); - } - out.format("};%n"); - out.format("%n"); - - out.format("#ifndef ACEUNIT_EMBEDDED%n"); - out.format("/** The test names of this fixture. */%n"); - out.format("static const char *const testNames[] = {%n"); - for (final String method : testMethods) { - out.format(" \"%s\",%n", method); - } - out.format("};%n"); - out.format("#endif%n"); - return out.toString(); - } - - /** Returns a String with the loop information for the test method ids. - * @return Source code with the loop information. - */ - public String getTestLoops() { - final Formatter out = new Formatter(); - out.format("#ifdef ACEUNIT_LOOP%n"); - out.format("/** The loops of this fixture. */%n"); - out.format("static const aceunit_loop_t loops[] = {%n"); - for (final String method : testMethods) { - out.format(" %s,%n", loopMethods.getArg(method)); // TODO Care about last comma? - } - out.format("};%n"); - out.format("#endif%n"); - return out.toString(); - } - - /** Returns a String with the group information for the test method ids. - * @return Source code with the group information. - */ - public String getTestGroups() { - final Formatter out = new Formatter(); - out.format("#ifdef ACEUNIT_GROUP%n"); - out.format("/** The groups of this fixture. */%n"); - out.format("static const AceGroupId_t groups[] = {%n"); - for (final String method : testMethods) { - out.format(" %s,%n", groupMethods.getArg(method)); // TODO Care about last comma? - } - out.format("};%n"); - out.format("#endif%n"); - return out.toString(); - } } // class MethodLists Modified: trunk/src/java/src/prj/net/sf/aceunit/MethodList.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2008-12-03 09:08:48 UTC (rev 483) +++ trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2008-12-03 09:30:44 UTC (rev 484) @@ -225,21 +225,19 @@ return methodNames.size(); } - /** - * Creates source code for an array of function pointers for this method list. - * - * @return Source code for the function pointer array. + /** Returns the variable name to use for symbols related to this MethodList. + * @return the variable name to use for symbols related to this MethodList. */ - public String getFunctionPointerList() { - final Formatter out = new Formatter(); - out.format("/** The %s of this fixture. */%n", title); - out.format("static const testMethod_t %s[] = {%n", symName); - for (final String method : this) { - out.format(" %s,%n", method); - } - out.format(" NULL%n"); - out.format("};%n"); - return out.toString(); + @NotNull + public String getSymName() { + return symName; } + /** Returns the title to use for this method list, used in comments. + * @return the title to use for this method list, used in comments. + */ + @NotNull + public String getTitle() { + return title; + } } // class MethodList This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |