aceunit-commit Mailing List for AceUnit (Page 15)
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...> - 2007-11-30 22:08:06
|
Revision: 233 http://aceunit.svn.sourceforge.net/aceunit/?rev=233&view=rev Author: christianhujer Date: 2007-11-30 14:08:07 -0800 (Fri, 30 Nov 2007) Log Message: ----------- [ 1841588 ] More than 1 Fixture: Fixture elements cause linker conflicts Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java trunk/src/java/src/prj/net/sf/aceunit/MethodList.java Added Paths: ----------- trunk/src/native/test/twoFixtures/ trunk/src/native/test/twoFixtures/Fixture1.c trunk/src/native/test/twoFixtures/Fixture2.c trunk/src/native/test/twoFixtures/Makefile trunk/src/native/test/twoFixtures/RunTest.c Modified: trunk/src/java/src/prj/net/sf/aceunit/Fixture.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2007-11-26 22:56:51 UTC (rev 232) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2007-11-30 22:08:07 UTC (rev 233) @@ -159,7 +159,7 @@ public String getTestMethodIds() { final Formatter out = new Formatter(); out.format("/** The test case ids of this fixture. */%n"); - out.format("TestCaseId_t testId[] = {%n"); + out.format("static TestCaseId_t testId[] = {%n"); out.format("#if defined(ACEUNIT_EMBEDDED)%n"); int methodCount = 0; final String formatString = String.format(" %%%dd, //%%s%%n", (int) (Math.log10(testMethods.size()) + 1)); Modified: trunk/src/java/src/prj/net/sf/aceunit/MethodList.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2007-11-26 22:56:51 UTC (rev 232) +++ trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2007-11-30 22:08:07 UTC (rev 233) @@ -174,7 +174,7 @@ public String getFunctionPointerList() { final Formatter out = new Formatter(); out.format("/** The %s of this fixture. */%n", title); - out.format("testMethod_t %s[] = {%n", symName); + out.format("static testMethod_t %s[] = {%n", symName); for (final String method : this) { out.format(" &%s,%n", method); } Added: trunk/src/native/test/twoFixtures/Fixture1.c =================================================================== --- trunk/src/native/test/twoFixtures/Fixture1.c (rev 0) +++ trunk/src/native/test/twoFixtures/Fixture1.c 2007-11-30 22:08:07 UTC (rev 233) @@ -0,0 +1,43 @@ +/* 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> + +#define ACEUNIT_ASSERTION_STYLE ACEUNIT_ASSERTION_STYLE_RETURN + +#include "Fixture1.h" + +/** Empty Test Case. Just used for testing whether two fixtures work. */ +A_Test void testFromFixture1() { +} Property changes on: trunk/src/native/test/twoFixtures/Fixture1.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/src/native/test/twoFixtures/Fixture2.c =================================================================== --- trunk/src/native/test/twoFixtures/Fixture2.c (rev 0) +++ trunk/src/native/test/twoFixtures/Fixture2.c 2007-11-30 22:08:07 UTC (rev 233) @@ -0,0 +1,43 @@ +/* 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> + +#define ACEUNIT_ASSERTION_STYLE ACEUNIT_ASSERTION_STYLE_RETURN + +#include "Fixture2.h" + +/** Empty Test Case. Just used for testing whether two fixtures work. */ +A_Test void testFromFixture2() { +} Property changes on: trunk/src/native/test/twoFixtures/Fixture2.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/src/native/test/twoFixtures/Makefile =================================================================== --- trunk/src/native/test/twoFixtures/Makefile (rev 0) +++ trunk/src/native/test/twoFixtures/Makefile 2007-11-30 22:08:07 UTC (rev 233) @@ -0,0 +1,62 @@ +LOGGER=FullPlainLogger +#LOGGER=MiniRamLogger + +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar + +ACE_UNIT_PATH=../../../ + +ACE_UNIT_JAVA_SRC=$(shell find $(ACE_UNIT_PATH)/java/src -name "*.java") + +FIXTURE_NAMES=Fixture1 Fixture2 + +FIXTURE_HEADERS=$(addsuffix .h, $(FIXTURE_NAMES)) +FIXTURE_SOURCES=$(addsuffix .c, $(FIXTURE_NAMES)) + +all: prepare compile test + +clean: + rm -f $(ACE_UNIT_FILES) $(FIXTURE_HEADERS) runTests *.gcov *.gcno *.gcda + +prepare: $(ACE_UNIT_FILES) + +AceUnit.c: $(ACE_UNIT_PATH)/native/AceUnit.c + cp $< $@ + +AceUnit.h: $(ACE_UNIT_PATH)/native/AceUnit.h + cp $< $@ + +AceUnitData.c: $(ACE_UNIT_PATH)/native/AceUnitData.c + cp $< $@ + +AceUnitAnnotations.h: $(ACE_UNIT_PATH)/native/AceUnitAnnotations.h + cp $< $@ + +AceUnitLogging.h: $(ACE_UNIT_PATH)/native/AceUnitLogging.h + cp $< $@ + +$(LOGGER).c: $(ACE_UNIT_PATH)/native/$(LOGGER).c + cp $< $@ + +AceUnit.jar: $(ACE_UNIT_PATH)/java/AceUnit.jar + cp $(ACE_UNIT_PATH)/java/AceUnit.jar $@ + +$(ACE_UNIT_PATH)/java/AceUnit.jar: $(ACE_UNIT_JAVA_SRC) + ant -f $(ACE_UNIT_PATH)/java/build.xml + +compile: runTests + +%.h: %.c AceUnit.jar + java -jar AceUnit.jar . + +runTests: $(FIXTURE_SOURCES) $(FIXTURE_HEADERS) $(ACE_UNIT_FILES) + $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c +# $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c + +test: runTests + ./runTests + +doc: $(FIXTURE_SOURCES).c $(FIXTURE_HEADERS).h $(ACE_UNIT_FILES) + doxygen + +coverage: test + gcov *.c Property changes on: trunk/src/native/test/twoFixtures/Makefile ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/native/test/twoFixtures/RunTest.c =================================================================== --- trunk/src/native/test/twoFixtures/RunTest.c (rev 0) +++ trunk/src/native/test/twoFixtures/RunTest.c 2007-11-30 22:08:07 UTC (rev 233) @@ -0,0 +1,62 @@ +/* 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> + +#define ACEUNIT_ASSERTION_STYLE ACEUNIT_ASSERTION_STYLE_RETURN + +#include "AceUnit.h" + +extern TestFixture_t Fixture1Fixture; +extern TestFixture_t Fixture2Fixture; + +/** Run the tests. + * @note This is only here temporarily. + * @note Command line arguments currently are ignored. + * In future versions, this part will be auto-generated. + * @param argc Command line argument count. + * @param argv Command line argument values. + * @return Exit status (currently always 0). + */ +int main(int argc, char *argv[]) { + extern uint16_t testCaseCount; + extern uint16_t testCaseFailureCount; + runFixture(&Fixture1Fixture); + runFixture(&Fixture2Fixture); + if (testCaseFailureCount != 0) { + fprintf(stderr, "Test Cases: %d Errors: %d\n", testCaseCount, testCaseFailureCount); + return 1; + } + return 0; +} Property changes on: trunk/src/native/test/twoFixtures/RunTest.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-26 22:56:48
|
Revision: 232 http://aceunit.svn.sourceforge.net/aceunit/?rev=232&view=rev Author: christianhujer Date: 2007-11-26 14:56:51 -0800 (Mon, 26 Nov 2007) Log Message: ----------- Creating branch for 0.3. Added Paths: ----------- branches/0.3/ Copied: branches/0.3 (from rev 231, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-26 22:54:49
|
Revision: 231 http://aceunit.svn.sourceforge.net/aceunit/?rev=231&view=rev Author: christianhujer Date: 2007-11-26 14:54:53 -0800 (Mon, 26 Nov 2007) Log Message: ----------- [ 1836413 ] Warning if no test cases found Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-11-26 22:53:21 UTC (rev 230) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-11-26 22:54:53 UTC (rev 231) @@ -79,51 +79,72 @@ * @param basename Base name to generate tests for. * This may be a file when appending '.c' or a directory or both. * If it is neither nor, an {@link IllegalArgumentException} is thrown. + * @return <code>true</code> if tests were found, otherwise <code>false</code>. * @throws IOException In case of I/O problems. * @throws IllegalArgumentException in case <var>basename</var> is not a directory and no file <code><var>basename</var>.c</code> was found. */ - private void perform(@NotNull final String basename) throws IOException { + private boolean perform(@NotNull final String basename) throws IOException { final File baseDir = new File(basename); final File fixtureFile = new File(basename + ".c"); - boolean found = false; + boolean baseFound = false; + boolean testsFound = false; if (baseDir.isDirectory()) { - found = true; - performPckg(baseDir, baseDir); + baseFound = true; + final boolean testsFoundInDirectory = performPckg(baseDir, baseDir); + testsFound |= testsFoundInDirectory; + if (!testsFoundInDirectory) { + System.err.println(baseDir + ": warning: No test cases found. Maybe the annotations are missing?"); + } } if (fixtureFile.isFile()) { - found = true; - performFixture(fixtureFile.getParentFile(), fixtureFile); + baseFound = true; + final boolean testsFoundInFile = performFixture(fixtureFile.getParentFile(), fixtureFile); + testsFound |= testsFoundInFile; + if (!testsFoundInFile) { + System.err.println(fixtureFile + ": warning: No test cases found. Maybe the annotations are missing?"); + } } - if (!found) { - throw new IllegalArgumentException(basename + ": no such directory. " + basename + ".c: no such file."); + 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: no input files"); } + if (!testsFound) { + System.err.println("AceUnit: no test cases"); + } + return baseFound || testsFound; } /** Performs the generation of tests for a package. * @param base Base directory of the tree, required to determine what part of the path is package. * @param pckg Directory to treat as package. + * @return <code>true</code> if the package tree contained a fixture, otherwise <code>false</code> * @throws IOException In case of I/O problems. */ - private void performPckg(@NotNull final File base, @NotNull final File pckg) throws IOException { + private boolean performPckg(@NotNull final File base, @NotNull final File pckg) throws IOException { assert pckg.isDirectory(); + boolean containedFixture = false; for (final File dir : pckg.listFiles(DIR_FILTER)) { - performPckg(base, dir); + containedFixture |= performPckg(base, dir); } for (final File fixtureFile : pckg.listFiles(C_SOURCE_FILTER)) { - performFixture(base, fixtureFile); + containedFixture |= performFixture(base, fixtureFile); } + return containedFixture; } /** Performs the generation of tests for a fixtureFile. * @param base Base directory of the tree, required to determine what part of the path is package. * @param fixtureFile File that contains the fixtureFile. + * @return <code>true</code> if the source code contained a fixture, otherwise <code>false</code> * @throws IOException In case of I/O problems. */ - private void performFixture(@NotNull final File base, @NotNull final File fixtureFile) throws IOException { + private boolean performFixture(@NotNull final File base, @NotNull final File fixtureFile) throws IOException { final String fixtureName = fixtureFile.getName().replaceAll("\\.c$", ""); final String cSource = readSource(fixtureFile); final Fixture fixture = new Fixture(); - if (fixture.findMethods(cSource)) { + final boolean containedFixture = fixture.findMethods(cSource); + if (containedFixture) { final File hFile = new File(fixtureFile.getParent(), fixtureName + ".h"); final String hSource = fixture.getFixtureCode(fixtureName); if (!hFile.exists() || !hSource.equals(readSource(hFile))) { @@ -132,6 +153,7 @@ out.close(); } } + return containedFixture; } /** Reads a source file. @@ -154,11 +176,13 @@ public int run(@NotNull final List<String> args) throws Exception { if (args.size() == 0) { help(); + return 1; } + boolean okay = true; for (final String basename : args) { - perform(basename); + okay &= perform(basename); } - return 0; + return okay ? 0 : 1; } } // class GenTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-26 22:53:23
|
Revision: 230 http://aceunit.svn.sourceforge.net/aceunit/?rev=230&view=rev Author: christianhujer Date: 2007-11-26 14:53:21 -0800 (Mon, 26 Nov 2007) Log Message: ----------- This runs on windows with Microsoft Visual Studio fine right now. Modified Paths: -------------- trunk/TODO Modified: trunk/TODO =================================================================== --- trunk/TODO 2007-11-26 22:48:26 UTC (rev 229) +++ trunk/TODO 2007-11-26 22:53:21 UTC (rev 230) @@ -1,6 +1,5 @@ * Create global build.xml for Building releases * Improve website layout (make it similar to that of Japi, Gridarta etc.) -* Make it run on Windows, too * Make better distinction between public API and internal symbols even in header files * Alternatively allow for naming schemes instead of annotations so users can go without the A_Test annotations. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-26 22:48:26
|
Revision: 229 http://aceunit.svn.sourceforge.net/aceunit/?rev=229&view=rev Author: christianhujer Date: 2007-11-26 14:48:26 -0800 (Mon, 26 Nov 2007) Log Message: ----------- Changed assert(false) into assert(0) to run in Visual Studio without further modification. Modified Paths: -------------- trunk/src/native/AceUnit.h Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2007-11-24 14:08:30 UTC (rev 228) +++ trunk/src/native/AceUnit.h 2007-11-26 22:48:26 UTC (rev 229) @@ -209,7 +209,7 @@ #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_RETURN #define ACEUNIT_ABORT return #elif ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_ASSERT - #define ACEUNIT_ABORT assert(false) + #define ACEUNIT_ABORT assert(0) #elif ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_ABORT #define ACEUNIT_ABORT abort() #elif ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-24 14:08:31
|
Revision: 228 http://aceunit.svn.sourceforge.net/aceunit/?rev=228&view=rev Author: christianhujer Date: 2007-11-24 06:08:30 -0800 (Sat, 24 Nov 2007) Log Message: ----------- Added missing dependency. Modified Paths: -------------- trunk/src/native/test/exhand/Makefile Modified: trunk/src/native/test/exhand/Makefile =================================================================== --- trunk/src/native/test/exhand/Makefile 2007-11-24 13:46:48 UTC (rev 227) +++ trunk/src/native/test/exhand/Makefile 2007-11-24 14:08:30 UTC (rev 228) @@ -17,7 +17,7 @@ compile: runTests -runTests: $(ACE_UNIT_FILES) +runTests: $(ACE_UNIT_FILES) TryExceptionHandling.c $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c # $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-24 13:46:44
|
Revision: 227 http://aceunit.svn.sourceforge.net/aceunit/?rev=227&view=rev Author: christianhujer Date: 2007-11-24 05:46:48 -0800 (Sat, 24 Nov 2007) Log Message: ----------- Improved test output / behaviour in make (return code). Modified Paths: -------------- trunk/src/native/test/basic/AceUnitTest.c trunk/src/native/test/exhand/TryExceptionHandling.c trunk/src/native/test/longjmp/LongJmpTest.c trunk/src/native/test/xmlLog/XmlLogTest.c Modified: trunk/src/native/test/basic/AceUnitTest.c =================================================================== --- trunk/src/native/test/basic/AceUnitTest.c 2007-11-19 23:21:14 UTC (rev 226) +++ trunk/src/native/test/basic/AceUnitTest.c 2007-11-24 13:46:48 UTC (rev 227) @@ -232,6 +232,9 @@ runFixture(&AceUnitTestFixture); extern uint16_t testCaseCount; extern uint16_t testCaseFailureCount; - printf("Test Cases: %d Errors: %d\n", testCaseCount, testCaseFailureCount); - return testCaseFailureCount != 0; + if (testCaseFailureCount != 0) { + fprintf(stderr, "Test Cases: %d Errors: %d\n", testCaseCount, testCaseFailureCount); + return 1; + } + return 0; } Modified: trunk/src/native/test/exhand/TryExceptionHandling.c =================================================================== --- trunk/src/native/test/exhand/TryExceptionHandling.c 2007-11-19 23:21:14 UTC (rev 226) +++ trunk/src/native/test/exhand/TryExceptionHandling.c 2007-11-24 13:46:48 UTC (rev 227) @@ -30,6 +30,5 @@ assert(++count == 9); /* should be reached. */ } endtry; assert(++count == 10); /* should be reached. */ - printf("done.\n"); return 0; } Modified: trunk/src/native/test/longjmp/LongJmpTest.c =================================================================== --- trunk/src/native/test/longjmp/LongJmpTest.c 2007-11-19 23:21:14 UTC (rev 226) +++ trunk/src/native/test/longjmp/LongJmpTest.c 2007-11-24 13:46:48 UTC (rev 227) @@ -67,6 +67,9 @@ runFixture(&LongJmpTestFixture); extern uint16_t testCaseCount; extern uint16_t testCaseFailureCount; - printf("Test Cases: %d Errors: %d (expecting 2)\n", testCaseCount, testCaseFailureCount); - return testCaseFailureCount != 2; + if (testCaseFailureCount != 2) { + fprintf(stderr, "Test Cases: %d Errors: %d (expecting 2)\n", testCaseCount, testCaseFailureCount); + return 1; + } + return 0; } Modified: trunk/src/native/test/xmlLog/XmlLogTest.c =================================================================== --- trunk/src/native/test/xmlLog/XmlLogTest.c 2007-11-19 23:21:14 UTC (rev 226) +++ trunk/src/native/test/xmlLog/XmlLogTest.c 2007-11-24 13:46:48 UTC (rev 227) @@ -58,6 +58,9 @@ extern uint16_t testCaseCount; extern uint16_t testCaseFailureCount; globalLogger->runnerEnded(); - printf("Test Cases: %d Errors: %d\n", testCaseCount, testCaseFailureCount); - return testCaseFailureCount != 0; + if (testCaseFailureCount != 0) { + fprintf(stderr, "Test Cases: %d Errors: %d\n", testCaseCount, testCaseFailureCount); + return 1; + } + return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-19 23:21:15
|
Revision: 226 http://aceunit.svn.sourceforge.net/aceunit/?rev=226&view=rev Author: christianhujer Date: 2007-11-19 15:21:14 -0800 (Mon, 19 Nov 2007) Log Message: ----------- Changed code to be strictly ISO C90 with only a few exceptions in the tests. The makefiles now will run GCC with the appropriate options. This should avoid problems with certain old-fashioned C-compilers that do not understand ISO C99, like MS Visual Studio. Modified Paths: -------------- trunk/src/native/AceUnit.c trunk/src/native/AceUnit.h trunk/src/native/AceUnitLogging.h trunk/src/native/FullPlainLogger.c trunk/src/native/JUnitXmlLogger.c trunk/src/native/MiniRamLogger.c trunk/src/native/test/basic/Makefile trunk/src/native/test/exhand/Makefile trunk/src/native/test/exhand/TryExceptionHandling.c trunk/src/native/test/longjmp/Makefile trunk/src/native/test/xmlLog/Makefile Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/AceUnit.c 2007-11-19 23:21:14 UTC (rev 226) @@ -86,7 +86,7 @@ #define globalLog(X, Y) if ((NULL != globalLogger) && (NULL != globalLogger->X)) {\ globalLogger->X(Y);\ } - const testMethod_t *secondary; // beforeClass, before, after, afterClass + const testMethod_t *secondary; /* beforeClass, before, after, afterClass */ const testMethod_t *testCase; const TestCaseId_t *testId; @@ -131,5 +131,5 @@ } } -// 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. +/* 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. */ Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/AceUnit.h 2007-11-19 23:21:14 UTC (rev 226) @@ -190,7 +190,7 @@ /* Abort style specific configuration. */ #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_RETURN - // nothing special + /* nothing special */ #elif ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_ASSERT #include <assert.h> #elif ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_ABORT @@ -200,7 +200,7 @@ /** Jump Buffer for AceUnit to abort a test case and jump back to the runner. */ extern jmp_buf aceunitJmpBuf; #elif ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_CUSTOM - // nothing special + /* nothing special */ #else #error Unknown value for ACEUNIT_ASSERTION_STYLE. #endif @@ -313,7 +313,7 @@ * @param expected Expected value. * @param actual Actual value. */ -#define assertEquals(message, expected, actual) if (!((expected) == (actual))) { fail(message); } // TODO: expected vs. actual in message +#define assertEquals(message, expected, actual) if (!((expected) == (actual))) { fail(message); } /* TODO: expected vs. actual in message */ /** Asserts that two values are not equal. * If the values are equal, the test case fails and raises an {@link AssertionError_t} that will be logged. @@ -321,7 +321,7 @@ * @param unexpected Not expected value. * @param actual Actual value. */ -#define assertNotEquals(message, unexpected, actual) if ((unexpected) == (actual)) { fail(message); } // TODO: expected vs. actual in message +#define assertNotEquals(message, unexpected, actual) if ((unexpected) == (actual)) { fail(message); } /* TODO: expected vs. actual in message */ /** Method signature for annotated test methods. * @see #A_Test Modified: trunk/src/native/AceUnitLogging.h =================================================================== --- trunk/src/native/AceUnitLogging.h 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/AceUnitLogging.h 2007-11-19 23:21:14 UTC (rev 226) @@ -86,7 +86,7 @@ #define ACEUNIT_LOG_TESTCASE #endif -// Note: Logging of failures cannot be turned off. +/* Note: Logging of failures cannot be turned off. */ /** A Logger logs events during test execution. * @@ -182,7 +182,7 @@ * @param suiteEnded Delegates to #TestLogger_t.suiteEnded. * @param runnerEnded Delegates to #TestLogger_t.runnerEnded. */ -// TODO if somebody knows a simplier way... +/* TODO if somebody knows a simplier way... */ #if !defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE) #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ testCaseFailed\ Modified: trunk/src/native/FullPlainLogger.c =================================================================== --- trunk/src/native/FullPlainLogger.c 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/FullPlainLogger.c 2007-11-19 23:21:14 UTC (rev 226) @@ -66,4 +66,4 @@ NULL ); -TestLogger_t *globalLogger = &FullPlainLogger; // XXX Hack. Remove. +TestLogger_t *globalLogger = &FullPlainLogger; /* XXX Hack. Remove. */ Modified: trunk/src/native/JUnitXmlLogger.c =================================================================== --- trunk/src/native/JUnitXmlLogger.c 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/JUnitXmlLogger.c 2007-11-19 23:21:14 UTC (rev 226) @@ -107,10 +107,10 @@ * @see TestLogger_t#fixtureStarted()} */ static void fixtureStarted(FixtureId_t fixture) { - suiteInfo.package = NULL; // TODO - suiteInfo.name = NULL; // TODO - suiteInfo.tests = 0; // TODO - suiteInfo.timestamp = NULL; // TODO + suiteInfo.package = NULL; /* TODO */ + suiteInfo.name = NULL; /* TODO */ + suiteInfo.tests = 0; /* TODO */ + suiteInfo.timestamp = NULL; /* TODO */ } /** @see TestLogger_t#testCaseStarted()} */ @@ -166,11 +166,11 @@ static void suiteEnded() { int i; FILE *localFile; - //<testsuite errors="0" failures="0" hostname="riedquat" id="1" name="BasicCommandTest" package="test.net.sf.japi.io.args" tests="10" time="0.105" timestamp="2007-11-06T20:15:24"> + /* <testsuite errors="0" failures="0" hostname="riedquat" id="1" name="BasicCommandTest" package="test.net.sf.japi.io.args" tests="10" time="0.105" timestamp="2007-11-06T20:15:24"> */ fprintf(globalFile, " <testsuite errors=\"%d\" failures=\"%d\" hostname=\"%s\" id=\"%d\" name=\"%s\" package=\"%s\" tests=\"%d\" time=\"%f\" timestamp=\"%s\">\n", 0/*TODO*/, 0/*TODO*/, globalInfo.hostname, 0/*TODO*/, NULL/*TODO*/, NULL/*TODO*/, 0/*TODO*/, 0.0/*TODO*/, NULL/*TODO*/); printEnvAsProperties(globalFile); for (i = 0; i < suiteInfo.tests; i++) { - //<testcase classname="test.net.sf.japi.io.args.BasicCommandTest" name="testHelp" time="0.0090" /> + /*<testcase classname="test.net.sf.japi.io.args.BasicCommandTest" name="testHelp" time="0.0090" />*/ fprintf(globalFile, " <testcase classname=\"%s\" name=\"%s\" time=\"%f\" />\n", NULL/*TODO*/, NULL/*TODO*/, 0.0/*TODO*/); } fprintf(globalFile, " <system-out/>\n"); @@ -178,13 +178,13 @@ fprintf(globalFile, " </testsuite>\n"); fflush(globalFile); - localFile = fopen("TEST-test.net.sf.japi.io.args.ArgParserTest.xml", "w"); // TODO: configure filename - //<testsuite errors="0" failures="0" hostname="riedquat" name="test.net.sf.japi.io.args.ArgParserTest" tests="19" time="3.463" timestamp="2007-11-06T20:15:21"> + localFile = fopen("TEST-test.net.sf.japi.io.args.ArgParserTest.xml", "w"); /* TODO: configure filename */ + /* <testsuite errors="0" failures="0" hostname="riedquat" name="test.net.sf.japi.io.args.ArgParserTest" tests="19" time="3.463" timestamp="2007-11-06T20:15:21"> */ fprintf(localFile, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); fprintf(localFile, "<testsuite errors=\"%d\" failures=\"%d\" hostname=\"%s\" name=\"%s\" tests=\"%d\" time=\"%f\" timestamp=\"%s\">\n", 0/*TODO*/, 0/*TODO*/, globalInfo.hostname, NULL/*TODO*/, 0/*TODO*/, 0.0/*TODO*/, NULL/*TODO*/); - fprintf(localFile, " <properties/>\n"); // TODO: encode environment as properties? + fprintf(localFile, " <properties/>\n"); /* TODO: encode environment as properties? */ for (i = 0; i < suiteInfo.tests; i++) { - //<testcase classname="test.net.sf.japi.io.args.ArgParserTest" name="testSimpleParseAndRun" time="0.0080" /> + /* <testcase classname="test.net.sf.japi.io.args.ArgParserTest" name="testSimpleParseAndRun" time="0.0080" /> */ fprintf(localFile, " <testcase classname=\"%s\" name=\"%s\" time=\"%f\" />\n", NULL/*TODO*/, NULL/*TODO*/, 0.0/*TODO*/); } fprintf(localFile, " <system-out/>\n"); @@ -213,4 +213,4 @@ runnerEnded ); -TestLogger_t *globalLogger = &JUnitXmlLogger; // XXX Hack. Remove. +TestLogger_t *globalLogger = &JUnitXmlLogger; /* XXX Hack. Remove. */ Modified: trunk/src/native/MiniRamLogger.c =================================================================== --- trunk/src/native/MiniRamLogger.c 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/MiniRamLogger.c 2007-11-19 23:21:14 UTC (rev 226) @@ -32,7 +32,7 @@ * @file MiniRamLogger.c */ -// TODO: Get rid of these includes. +/* TODO: Get rid of these includes. */ #include <stdio.h> #include <string.h> @@ -70,12 +70,13 @@ * @param file File to write to. */ void MiniRamLoggerSave(FILE *file) { - // The file will first contain a BOM (byte order mark). - // That enables tools that read this file to find out whether it was written in Big Endian or Little Endian. + /* The file will first contain a BOM (byte order mark). + * That enables tools that read this file to find out whether it was written in Big Endian or Little Endian. + */ uint16_t bom = 0xFFFE; fwrite(&bom, sizeof(uint16_t), 1, file); - // Now write the data. + /* Now write the data. */ fwrite(data, sizeof(AssertionError_t), elementCount, file); } @@ -92,4 +93,4 @@ NULL ); -TestLogger_t *globalLogger = &MiniRamLogger; // XXX Hack. Remove. +TestLogger_t *globalLogger = &MiniRamLogger; /* XXX Hack. Remove. */ Modified: trunk/src/native/test/basic/Makefile =================================================================== --- trunk/src/native/test/basic/Makefile 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/test/basic/Makefile 2007-11-19 23:21:14 UTC (rev 226) @@ -46,8 +46,8 @@ java -jar AceUnit.jar $(FIXTURE_NAME) runTests: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) - $(CC) -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c -# $(CC) -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c + $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c +# $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c test: runTests ./runTests Modified: trunk/src/native/test/exhand/Makefile =================================================================== --- trunk/src/native/test/exhand/Makefile 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/test/exhand/Makefile 2007-11-19 23:21:14 UTC (rev 226) @@ -18,8 +18,8 @@ compile: runTests runTests: $(ACE_UNIT_FILES) - $(CC) -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c -# $(CC) -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c + $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c +# $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c test: runTests ./runTests Modified: trunk/src/native/test/exhand/TryExceptionHandling.c =================================================================== --- trunk/src/native/test/exhand/TryExceptionHandling.c 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/test/exhand/TryExceptionHandling.c 2007-11-19 23:21:14 UTC (rev 226) @@ -6,30 +6,30 @@ int main(int argc, char *argv[]) { int count = 0; - assert(++count == 1); // should be reached. + assert(++count == 1); /* should be reached. */ try { - assert(++count == 2); // should be reached. + assert(++count == 2); /* should be reached. */ try { - assert(++count == 3); // should be reached. + assert(++count == 3); /* should be reached. */ try { - assert(++count == 4); // should be reached. + assert(++count == 4); /* should be reached. */ throw(1); - assert(false); // should NOT be reached. + assert(false); /* should NOT be reached. */ } catch (2) { - assert(false); // should NOT be reached. + assert(false); /* should NOT be reached. */ } finally { - assert(++count == 5); // should be reached. + assert(++count == 5); /* should be reached. */ } endtry; } catch (1) { - assert(++count == 6); // should be reached. + assert(++count == 6); /* should be reached. */ } finally { - assert(++count == 7); // should be reached. + assert(++count == 7); /* should be reached. */ } endtry; - assert(++count == 8); // should be reached. + assert(++count == 8); /* should be reached. */ } finally { - assert(++count == 9); // should be reached. + assert(++count == 9); /* should be reached. */ } endtry; - assert(++count == 10); // should be reached. + assert(++count == 10); /* should be reached. */ printf("done.\n"); return 0; } Modified: trunk/src/native/test/longjmp/Makefile =================================================================== --- trunk/src/native/test/longjmp/Makefile 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/test/longjmp/Makefile 2007-11-19 23:21:14 UTC (rev 226) @@ -46,8 +46,8 @@ java -jar AceUnit.jar $(FIXTURE_NAME) runTests: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) - $(CC) -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c -# $(CC) -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c + $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c +# $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c test: runTests ./runTests Modified: trunk/src/native/test/xmlLog/Makefile =================================================================== --- trunk/src/native/test/xmlLog/Makefile 2007-11-19 23:00:29 UTC (rev 225) +++ trunk/src/native/test/xmlLog/Makefile 2007-11-19 23:21:14 UTC (rev 226) @@ -45,8 +45,8 @@ java -jar AceUnit.jar $(FIXTURE_NAME) runTests: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) - $(CC) -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c -# $(CC) -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c + $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c +# $(CC) -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c test: runTests ./runTests ; echo $$? ; true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-19 23:00:35
|
Revision: 225 http://aceunit.svn.sourceforge.net/aceunit/?rev=225&view=rev Author: christianhujer Date: 2007-11-19 15:00:29 -0800 (Mon, 19 Nov 2007) Log Message: ----------- Changed newAssertionError to work with MS Visual Studio compiler. Modified Paths: -------------- trunk/src/native/AceUnit.h Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2007-11-18 23:16:20 UTC (rev 224) +++ trunk/src/native/AceUnit.h 2007-11-19 23:00:29 UTC (rev 225) @@ -267,9 +267,9 @@ * @param message Message to create. */ #ifdef ACEUNIT_EMBEDDED -#define newAssertionError(message) recordError(A_FIXTURE_ID, (AssertionId_t) {__LINE__}); ACEUNIT_ABORT +#define newAssertionError(message) { AssertionId_t assertion = { __LINE__ }; recordError(A_FIXTURE_ID, assertion); } ACEUNIT_ABORT #else -#define newAssertionError(message) recordError(__FILE__, (AssertionId_t) {__LINE__, message}); ACEUNIT_ABORT +#define newAssertionError(message) { AssertionId_t assertion = { __LINE__, message }; recordError(__FILE__, assertion); } ACEUNIT_ABORT #endif /** Assertion Error. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 23:16:26
|
Revision: 224 http://aceunit.svn.sourceforge.net/aceunit/?rev=224&view=rev Author: christianhujer Date: 2007-11-18 15:16:20 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Updated manual. Modified Paths: -------------- trunk/src/doc/manual.xhtml Modified: trunk/src/doc/manual.xhtml =================================================================== --- trunk/src/doc/manual.xhtml 2007-11-18 23:16:01 UTC (rev 223) +++ trunk/src/doc/manual.xhtml 2007-11-18 23:16:20 UTC (rev 224) @@ -16,6 +16,44 @@ AceUnit is JUnit 4.x style, easy, modular and flexible. AceUnit can be used in resource constraint environments, e.g. embedded software development. </p> + <h2>Quick Overview</h2> + <p> + Unit Tests in AceUnit are declared using annotations. + This works pretty much the same as JUnit 4.x. + JUnit 4.x can be considered industry reference for unit test frameworks. + Much of AceUnit was modelled after JUnit 4.x. + </p> + <p> + The most important annotation that you will need is <code>A_Test</code>. + The <code>A_Test</code> annotation tells AceUnit that a function is a unit test. + Simply place this as a modifier before your function declaration, where you would write static in case you would declare your function static. + This annotation will be the main interface between your unit tests and the AceUnit framework which will run them. + </p> + <h4>Example</h4> + <pre>A_Test void someTestMethod() [ + // test case implementation for this test case goes here +}</pre> + <p> + Assume your source is named <samp>MyTest.c</samp>. + There are only two more things which you will need in your source. + Both of these things are very easy. + </p> + <ul> + <li>Put <code>#include "MyTest.h"</code> at the beginning of your source to include the required header file.</li> + <li>Run <code>java -jar AceUnit.jar MyTest >MyTest.h</code> to generate this header file.</li> + </ul> + <p> + That's all what you need. + </p> + <h3>What is <code>AceUnit.jar</code>?</h3> + <p> + <code>AceUnit.jar</code> is a Java program and the core for automation in AceUnit. + It scans a test source code and will generate all required information that the AceUnit framework will need to run your tests. + That information will be placed in the specified header file. + </p> + <p> + We know that running Java in a C environment is not convenient in + </p> <h2>Variants of Unit Test Declaration</h2> <p> AceUnit supports <!--two-->the following styles of declaring unit tests: @@ -45,6 +83,7 @@ Ignore annotation, use for test cases to ignore. This annotation is only allowed for methods annotated as <code>A_Test</code>. </dd> + <!-- <dt><code>A_IGnoreR(reason)</code></dt> <dd> Ignore annotation, use for test cases to ignore. @@ -52,6 +91,7 @@ <br /> <code>reason</code>: Description of the reason why this test case is currently ignored. </dd> + --> </dl> <!-- <h3>Naming Convention based testing</h3> @@ -157,6 +197,22 @@ <dd> By defining this macro you will cause annotations to be equivalent to <code>static</code>. That way you have easy and flexible control over whether test methods are static or not. + <p /> + Declaring test methods as static has a significant advantage. + You will be able to use the same name in different fixtures and still build and run them all together. + For logging, it is not required that test methods have unique names. + Logging will always also include the associated fixture (e.g. filename + line number). + So you will always uniquely identify which test case failed, even if the names of the test cases are not unique. + <p /> + However, there are debuggers which will cause head ache if you try to debug functions which are static. + Some tool chains (compilers / linkers) will not emit proper debug information for functions which are static. + <p /> + The pros and cons for static test methods are both very significant. + Whether or not you want to use static depends on your environment. + Because of that, we've left the choice to you. + <p /> + But we've prepared everything for you. + Toggling between these two options is as simple as (not) defining this macro. </dd> <dt><code>#define ACEUNIT_EMBEDDED</code></dt> <dd> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 23:16:02
|
Revision: 223 http://aceunit.svn.sourceforge.net/aceunit/?rev=223&view=rev Author: christianhujer Date: 2007-11-18 15:16:01 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Added two TODO entries. Modified Paths: -------------- trunk/TODO Modified: trunk/TODO =================================================================== --- trunk/TODO 2007-11-18 22:09:25 UTC (rev 222) +++ trunk/TODO 2007-11-18 23:16:01 UTC (rev 223) @@ -10,3 +10,5 @@ * Add randomization of test order. * Add JUnit-compatible loggers. * Add proper runner tree that makes makes use of every logger method. +* Add generation of main() +* Add suites that consist of suites and fixtures. Suites are packages for now. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 22:12:08
|
Revision: 222 http://aceunit.svn.sourceforge.net/aceunit/?rev=222&view=rev Author: christianhujer Date: 2007-11-18 14:09:25 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Added missing doxygen comments in generated header file. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java Modified: trunk/src/java/src/prj/net/sf/aceunit/Fixture.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2007-11-18 21:04:54 UTC (rev 221) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2007-11-18 22:09:25 UTC (rev 222) @@ -89,10 +89,12 @@ final String ucaseFixture = basename.toUpperCase(); out.format("#ifndef _%s_H%n", ucaseFixture); + out.format("/** Include shield to protect this header file from being included more than once. */%n"); out.format("#define _%s_H%n", ucaseFixture); out.format("%n"); out.format("#ifndef A_FIXTURE_ID%n"); + out.format("/** The id of this fixture. */%n"); out.format("#ifdef ACEUNIT_EMBEDED%n"); out.format("#define A_FIXTURE_ID %d%n", id); out.format("#else%n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 21:04:54
|
Revision: 221 http://aceunit.svn.sourceforge.net/aceunit/?rev=221&view=rev Author: christianhujer Date: 2007-11-18 13:04:54 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Extracted file filters as constants. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-11-18 20:13:48 UTC (rev 220) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-11-18 21:04:54 UTC (rev 221) @@ -45,6 +45,21 @@ */ public class GenTest extends BasicCommand { + /** FileFilter to get directories. */ + private static final FileFilter DIR_FILTER = new FileFilter() { + /** {@inheritDoc} */ + public boolean accept(@NotNull final File pathname) { + return pathname.isDirectory(); + } + }; + + /** FileFilter to get C source files. */ + private static final FileFilter C_SOURCE_FILTER = new FileFilter() { + public boolean accept(final File pathname) { + return pathname.isFile() && pathname.getName().endsWith(".c"); + } + }; + /** Main program. * @param args Currently the first argument must be the base name of the file to create a fixture for, e.g. "example", without file ending. * @note the interface is subject of change. @@ -91,18 +106,10 @@ */ private void performPckg(@NotNull final File base, @NotNull final File pckg) throws IOException { assert pckg.isDirectory(); - for (final File dir : pckg.listFiles(new FileFilter() { - public boolean accept(final File pathname) { - return pathname.isDirectory(); - } - })) { + for (final File dir : pckg.listFiles(DIR_FILTER)) { performPckg(base, dir); } - for (final File fixtureFile : pckg.listFiles(new FileFilter() { - public boolean accept(final File pathname) { - return pathname.isFile() && pathname.getName().endsWith(".c"); - } - })) { + for (final File fixtureFile : pckg.listFiles(C_SOURCE_FILTER)) { performFixture(base, fixtureFile); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 20:13:44
|
Revision: 220 http://aceunit.svn.sourceforge.net/aceunit/?rev=220&view=rev Author: christianhujer Date: 2007-11-18 12:13:48 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Changed writing of header file to only write if the header file doesn't exist or would have a different content. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-11-18 19:34:15 UTC (rev 219) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-11-18 20:13:48 UTC (rev 220) @@ -117,10 +117,13 @@ final String cSource = readSource(fixtureFile); final Fixture fixture = new Fixture(); if (fixture.findMethods(cSource)) { + final File hFile = new File(fixtureFile.getParent(), fixtureName + ".h"); final String hSource = fixture.getFixtureCode(fixtureName); - final PrintWriter out = new PrintWriter(new FileWriter(new File(fixtureFile.getParent(), fixtureName + ".h"))); - out.append(hSource); - out.close(); + if (!hFile.exists() || !hSource.equals(readSource(hFile))) { + final PrintWriter out = new PrintWriter(new FileWriter(hFile)); + out.append(hSource); + out.close(); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 19:38:32
|
Revision: 219 http://aceunit.svn.sourceforge.net/aceunit/?rev=219&view=rev Author: christianhujer Date: 2007-11-18 11:34:15 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Implemented recursive fixture header file generation. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-11-18 16:15:27 UTC (rev 218) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-11-18 19:34:15 UTC (rev 219) @@ -28,6 +28,7 @@ package net.sf.aceunit; import java.io.File; +import java.io.FileFilter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; @@ -44,9 +45,6 @@ */ public class GenTest extends BasicCommand { - /** All method lists for easy iteration. */ - private final Fixture fixture = new Fixture(); - /** Main program. * @param args Currently the first argument must be the base name of the file to create a fixture for, e.g. "example", without file ending. * @note the interface is subject of change. @@ -62,34 +60,77 @@ public GenTest() throws IOException { } - /** Performs the generation of a test. - * @param fullname Basename to generate test for. - * @throws IOException in case of I/O problems. + /** Performs the generation of tests. + * @param basename Base name to generate tests for. + * This may be a file when appending '.c' or a directory or both. + * If it is neither nor, an {@link IllegalArgumentException} is thrown. + * @throws IOException In case of I/O problems. + * @throws IllegalArgumentException in case <var>basename</var> is not a directory and no file <code><var>basename</var>.c</code> was found. */ - private void perform(@NotNull final String fullname) throws IOException { - final File file = new File(fullname); - final String basename = file.getName(); - if (file.isDirectory()) { + private void perform(@NotNull final String basename) throws IOException { + final File baseDir = new File(basename); + final File fixtureFile = new File(basename + ".c"); + boolean found = false; + if (baseDir.isDirectory()) { + found = true; + performPckg(baseDir, baseDir); + } + if (fixtureFile.isFile()) { + found = true; + performFixture(fixtureFile.getParentFile(), fixtureFile); + } + if (!found) { + throw new IllegalArgumentException(basename + ": no such directory. " + basename + ".c: no such file."); + } + } - } else { - final String cSource = readSource(fullname + ".c"); - if (fixture.findMethods(cSource)) { - final String hSource = fixture.getFixtureCode(basename); - final PrintWriter out = new PrintWriter(new FileWriter(fullname + ".h")); - out.append(hSource); - out.close(); + /** Performs the generation of tests for a package. + * @param base Base directory of the tree, required to determine what part of the path is package. + * @param pckg Directory to treat as package. + * @throws IOException In case of I/O problems. + */ + private void performPckg(@NotNull final File base, @NotNull final File pckg) throws IOException { + assert pckg.isDirectory(); + for (final File dir : pckg.listFiles(new FileFilter() { + public boolean accept(final File pathname) { + return pathname.isDirectory(); } + })) { + performPckg(base, dir); } + for (final File fixtureFile : pckg.listFiles(new FileFilter() { + public boolean accept(final File pathname) { + return pathname.isFile() && pathname.getName().endsWith(".c"); + } + })) { + performFixture(base, fixtureFile); + } } + /** Performs the generation of tests for a fixtureFile. + * @param base Base directory of the tree, required to determine what part of the path is package. + * @param fixtureFile File that contains the fixtureFile. + * @throws IOException In case of I/O problems. + */ + private void performFixture(@NotNull final File base, @NotNull final File fixtureFile) throws IOException { + final String fixtureName = fixtureFile.getName().replaceAll("\\.c$", ""); + final String cSource = readSource(fixtureFile); + final Fixture fixture = new Fixture(); + if (fixture.findMethods(cSource)) { + final String hSource = fixture.getFixtureCode(fixtureName); + final PrintWriter out = new PrintWriter(new FileWriter(new File(fixtureFile.getParent(), fixtureName + ".h"))); + out.append(hSource); + out.close(); + } + } + /** Reads a source file. - * @param filename Filename of the source to read. + * @param file File of the source to read. * @return String with the contents of the specified file. * @throws IOException in case of I/O problems. */ - private String readSource(@NotNull final String filename) throws IOException { - final File f = new File(filename); - final FileReader in = new FileReader(f); + private String readSource(@NotNull final File file) throws IOException { + final FileReader in = new FileReader(file); final StringBuilder sb = new StringBuilder(); final char[] buf = new char[4096]; for (int charsRead; (charsRead = in.read(buf)) != -1;) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 16:15:24
|
Revision: 218 http://aceunit.svn.sourceforge.net/aceunit/?rev=218&view=rev Author: christianhujer Date: 2007-11-18 08:15:27 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Added test makefile to automate running individual tests. Added Paths: ----------- trunk/src/native/test/Makefile Added: trunk/src/native/test/Makefile =================================================================== --- trunk/src/native/test/Makefile (rev 0) +++ trunk/src/native/test/Makefile 2007-11-18 16:15:27 UTC (rev 218) @@ -0,0 +1,7 @@ +DIRS=basic exhand longjmp xmlLog + +all: + @for dir in $(DIRS) ; do (cd $$dir ; make) ; done + +clean: + @for dir in $(DIRS) ; do (cd $$dir ; make clean) ; done This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 15:10:39
|
Revision: 217 http://aceunit.svn.sourceforge.net/aceunit/?rev=217&view=rev Author: christianhujer Date: 2007-11-18 07:10:44 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Changed generator to write file instead of stdout. Eventually already works recursive (untested). Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java trunk/src/java/src/prj/net/sf/aceunit/GenTest.java trunk/src/native/test/basic/Makefile trunk/src/native/test/longjmp/Makefile trunk/src/native/test/xmlLog/Makefile Modified: trunk/src/java/src/prj/net/sf/aceunit/Fixture.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2007-11-18 15:09:39 UTC (rev 216) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2007-11-18 15:10:44 UTC (rev 217) @@ -59,12 +59,16 @@ /** Finds all methods of all method lists in the specified source. * @param cSource C source to search. + * @return Whether methods were found. + * @retval true if the fixture contains at least one test case. + * @retval false if the fixture contains zero test cases. */ - public void findMethods(@NotNull final String cSource) { + public boolean findMethods(@NotNull final String cSource) { for (final MethodList methodList : methodLists) { methodList.findMethods(cSource); } testMethods.removeAll(ignoreMethods); + return testMethods.size() > 0; } /** Returns a String representing the C-Source code for the fixture. Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-11-18 15:09:39 UTC (rev 216) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-11-18 15:10:44 UTC (rev 217) @@ -29,8 +29,9 @@ import java.io.File; import java.io.FileReader; +import java.io.FileWriter; import java.io.IOException; -import java.io.PrintStream; +import java.io.PrintWriter; import java.util.List; import net.sf.japi.io.args.ArgParser; import net.sf.japi.io.args.BasicCommand; @@ -41,39 +42,44 @@ * The final version should be in C so a developer is not required to run Java in a C development environment. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class GenTest<T extends Appendable> extends BasicCommand { +public class GenTest extends BasicCommand { /** All method lists for easy iteration. */ private final Fixture fixture = new Fixture(); - /** Output to write to. */ - private final T out; - /** Main program. * @param args Currently the first argument must be the base name of the file to create a fixture for, e.g. "example", without file ending. * @note the interface is subject of change. * @throws IOException in case of I/O problems. */ public static void main(@NotNull final String... args) throws IOException { - ArgParser.simpleParseAndRun(new GenTest<PrintStream>(System.out), args); + ArgParser.simpleParseAndRun(new GenTest(), args); } /** Creates a GenTest instance. - * @param out Where to write the generated results. * @throws IOException in case of I/O problems. */ - public GenTest(@NotNull final T out) throws IOException { - this.out = out; + public GenTest() throws IOException { } /** Performs the generation of a test. - * @param basename Basename to generate test for. + * @param fullname Basename to generate test for. * @throws IOException in case of I/O problems. */ - private void perform(@NotNull final String basename) throws IOException { - final String cSource = readSource(basename + ".c"); - fixture.findMethods(cSource); - out.append(fixture.getFixtureCode(basename)); + private void perform(@NotNull final String fullname) throws IOException { + final File file = new File(fullname); + final String basename = file.getName(); + if (file.isDirectory()) { + + } else { + final String cSource = readSource(fullname + ".c"); + if (fixture.findMethods(cSource)) { + final String hSource = fixture.getFixtureCode(basename); + final PrintWriter out = new PrintWriter(new FileWriter(fullname + ".h")); + out.append(hSource); + out.close(); + } + } } /** Reads a source file. Modified: trunk/src/native/test/basic/Makefile =================================================================== --- trunk/src/native/test/basic/Makefile 2007-11-18 15:09:39 UTC (rev 216) +++ trunk/src/native/test/basic/Makefile 2007-11-18 15:10:44 UTC (rev 217) @@ -43,7 +43,7 @@ compile: runTests $(FIXTURE_NAME).h: AceUnit.jar $(FIXTURE_NAME).c - java -jar AceUnit.jar $(FIXTURE_NAME) >$(FIXTURE_NAME).h + java -jar AceUnit.jar $(FIXTURE_NAME) runTests: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) $(CC) -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c Modified: trunk/src/native/test/longjmp/Makefile =================================================================== --- trunk/src/native/test/longjmp/Makefile 2007-11-18 15:09:39 UTC (rev 216) +++ trunk/src/native/test/longjmp/Makefile 2007-11-18 15:10:44 UTC (rev 217) @@ -43,7 +43,7 @@ compile: runTests $(FIXTURE_NAME).h: AceUnit.jar $(FIXTURE_NAME).c - java -jar AceUnit.jar $(FIXTURE_NAME) >$(FIXTURE_NAME).h + java -jar AceUnit.jar $(FIXTURE_NAME) runTests: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) $(CC) -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c Modified: trunk/src/native/test/xmlLog/Makefile =================================================================== --- trunk/src/native/test/xmlLog/Makefile 2007-11-18 15:09:39 UTC (rev 216) +++ trunk/src/native/test/xmlLog/Makefile 2007-11-18 15:10:44 UTC (rev 217) @@ -42,7 +42,7 @@ compile: runTests $(FIXTURE_NAME).h: AceUnit.jar $(FIXTURE_NAME).c - java -jar AceUnit.jar $(FIXTURE_NAME) >$(FIXTURE_NAME).h + java -jar AceUnit.jar $(FIXTURE_NAME) runTests: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) $(CC) -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 15:09:49
|
Revision: 216 http://aceunit.svn.sourceforge.net/aceunit/?rev=216&view=rev Author: christianhujer Date: 2007-11-18 07:09:39 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Fixed example Makefile - AceUnitLogging.h was missing. Modified Paths: -------------- trunk/src/doc/examples/sort/Makefile Modified: trunk/src/doc/examples/sort/Makefile =================================================================== --- trunk/src/doc/examples/sort/Makefile 2007-11-18 14:54:52 UTC (rev 215) +++ trunk/src/doc/examples/sort/Makefile 2007-11-18 15:09:39 UTC (rev 216) @@ -1,4 +1,4 @@ -ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h FullPlainLogger.c AceUnit.jar +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h FullPlainLogger.c AceUnit.jar ACE_UNIT_PATH=../../../ @@ -23,6 +23,9 @@ AceUnitAnnotations.h: $(ACE_UNIT_PATH)/native/AceUnitAnnotations.h cp $< $@ +AceUnitLogging.h: $(ACE_UNIT_PATH)/native/AceUnitLogging.h + cp $< $@ + FullPlainLogger.c: $(ACE_UNIT_PATH)/native/FullPlainLogger.c cp $< $@ @@ -35,7 +38,7 @@ compile: runTests $(FIXTURE_NAME).h: AceUnit.jar $(FIXTURE_NAME).c - java -jar AceUnit.jar $(FIXTURE_NAME) >$(FIXTURE_NAME).h + java -jar AceUnit.jar $(FIXTURE_NAME) runTests: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) $(CC) -Wall -g -o runTests *.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 14:54:53
|
Revision: 215 http://aceunit.svn.sourceforge.net/aceunit/?rev=215&view=rev Author: christianhujer Date: 2007-11-18 06:54:52 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Added generation of table of contents. Modified Paths: -------------- trunk/src/doc/transform.xslt Modified: trunk/src/doc/transform.xslt =================================================================== --- trunk/src/doc/transform.xslt 2007-11-18 14:21:31 UTC (rev 214) +++ trunk/src/doc/transform.xslt 2007-11-18 14:54:52 UTC (rev 215) @@ -86,6 +86,36 @@ </xsl:copy> </xsl:template> + <!-- Generate a table of contents if required. --> + <xsl:template match="html:h2[@id='toc']"> + <h2 id="toc">Table of Contents</h2> + <ul> + <xsl:for-each select="/html:html/html:body/html:h2"> + <li> + <a> + <xsl:attribute name="href"> + <xsl:text>#</xsl:text> + <xsl:choose> + <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when> + <xsl:otherwise><xsl:value-of select="generate-id()"/></xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:if test="@id='toc'">Table of Contents</xsl:if> + <xsl:apply-templates/> + </a> + </li> + </xsl:for-each> + </ul> + </xsl:template> + + <!-- Generate ids for headings without ids so the table of contents can link to them. --> + <xsl:template match="html:h2[not(@id)]"> + <xsl:copy> + <xsl:attribute name="id"><xsl:value-of select="generate-id()"/></xsl:attribute> + <xsl:apply-templates select="@*|node()" /> + </xsl:copy> + </xsl:template> + <!-- Everything else: Copy without change. --> <xsl:template match="@*|node()"> <xsl:copy> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 14:21:40
|
Revision: 214 http://aceunit.svn.sourceforge.net/aceunit/?rev=214&view=rev Author: christianhujer Date: 2007-11-18 06:21:31 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Fixed doxygen issue - wrong symbol name for link. Modified Paths: -------------- trunk/src/native/AceUnitLogging.h Modified: trunk/src/native/AceUnitLogging.h =================================================================== --- trunk/src/native/AceUnitLogging.h 2007-11-18 14:19:08 UTC (rev 213) +++ trunk/src/native/AceUnitLogging.h 2007-11-18 14:21:31 UTC (rev 214) @@ -54,7 +54,7 @@ #ifndef ACEUNIT_LOGGING_STYLE /** Determines the style of logging to use. * Defaults to #ACEUNIT_LOGGING_STYLE_SIMPLE if #ACEUNIT_EMBEDDED is defined. - * Defaults to #ACEUNIT_LOGGING_FULL otherwise. + * Defaults to #ACEUNIT_LOGGING_STYLE_FULL otherwise. * * @see #ACEUNIT_LOGGING_STYLE_SIMPLE * @see #ACEUNIT_LOGGING_STYLE_FULL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 14:19:57
|
Revision: 213 http://aceunit.svn.sourceforge.net/aceunit/?rev=213&view=rev Author: christianhujer Date: 2007-11-18 06:19:08 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Made logging style configurable. Modified Paths: -------------- trunk/src/native/AceUnitLogging.h Modified: trunk/src/native/AceUnitLogging.h =================================================================== --- trunk/src/native/AceUnitLogging.h 2007-11-18 13:59:34 UTC (rev 212) +++ trunk/src/native/AceUnitLogging.h 2007-11-18 14:19:08 UTC (rev 213) @@ -38,6 +38,56 @@ * @file AceUnitLogging.h */ +/** Value for #ACEUNIT_LOGGING_STYLE for only logging failures. + * This is primarily meant for embedded systems where everything should be as small and simple as possible. + * + * @see #ACEUNIT_LOGGING_STYLE + */ +#define ACEUNIT_LOGGING_STYLE_SIMPLE 1 + +/** Value for #ACEUNIT_LOGGING_STYLE for full logging with all events. + * + * @see #ACEUNIT_LOGGING_STYLE + */ +#define ACEUNIT_LOGGING_STYLE_FULL 2 + +#ifndef ACEUNIT_LOGGING_STYLE +/** Determines the style of logging to use. + * Defaults to #ACEUNIT_LOGGING_STYLE_SIMPLE if #ACEUNIT_EMBEDDED is defined. + * Defaults to #ACEUNIT_LOGGING_FULL otherwise. + * + * @see #ACEUNIT_LOGGING_STYLE_SIMPLE + * @see #ACEUNIT_LOGGING_STYLE_FULL + */ +#ifdef ACEUNIT_EMBEDDED +#define ACEUNIT_LOGGING_STYLE ACEUNIT_LOGGING_STYLE_SIMPLE +#else +#define ACEUNIT_LOGGING_STYLE ACEUNIT_LOGGING_STYLE_FULL +#endif +#endif + +#if ACEUNIT_LOGGING_STYLE == ACEUNIT_LOGGING_STYLE_FULL +/** Determines that runner events are logged. */ +#define ACEUNIT_LOG_RUNNER +#endif + +#if ACEUNIT_LOGGING_STYLE == ACEUNIT_LOGGING_STYLE_FULL +/** Determines that suite events are logged. */ +#define ACEUNIT_LOG_SUITE +#endif + +#if ACEUNIT_LOGGING_STYLE == ACEUNIT_LOGGING_STYLE_FULL +/** Determines that fixture events are logged. */ +#define ACEUNIT_LOG_FIXTURE +#endif + +#if ACEUNIT_LOGGING_STYLE == ACEUNIT_LOGGING_STYLE_FULL +/** Determines that test case events are logged. */ +#define ACEUNIT_LOG_TESTCASE +#endif + +// Note: Logging of failures cannot be turned off. + /** A Logger logs events during test execution. * * @warning When you write a logger, you should not use this structure directly. @@ -49,27 +99,35 @@ */ typedef struct { +#ifdef ACEUNIT_LOG_RUNNER /** Informs this logger that the runner has started running. * Maybe #NULL in case this logger does not implement this function. */ void(*runnerStarted)(); +#endif +#ifdef ACEUNIT_LOG_SUITE /** Informs this logger that the runner has started a suite. * Maybe #NULL in case this logger does not implement this function. */ void(*suiteStarted)(); +#endif +#ifdef ACEUNIT_LOG_FIXTURE /** Informs this logger that the runner has started a fixture. * Maybe #NULL in case this logger does not implement this function. * @param fixture Fixture that was started. */ void(*fixtureStarted)(const FixtureId_t fixture); +#endif +#ifdef ACEUNIT_LOG_TESTCASE /** Informs this logger that the runner starts a test case. * Maybe #NULL in case this logger does not implement this function. * @param testCase Test case that was started. */ void(*testCaseStarted)(TestCaseId_t testCase); +#endif /** Informs this logger that the runner failed a test case. * Maybe #NULL in case this logger does not implement this function. @@ -77,28 +135,36 @@ */ void(*testCaseFailed)(const AssertionError_t *error); +#ifdef ACEUNIT_LOG_TESTCASE /** Informs this logger that the runner ended a test case. * This will be invoked for failed test cases as well as for successful test cases. * Maybe #NULL in case this logger does not implement this function. * @param testCase Test case that was ended. */ void(*testCaseEnded)(TestCaseId_t testCase); +#endif +#ifdef ACEUNIT_LOG_FIXTURE /** Informs this logger that the runner has ended a fixture. * Maybe #NULL in case this logger does not implement this function. * @param fixture Fixture that was ended. */ void(*fixtureEnded)(FixtureId_t fixture); +#endif +#ifdef ACEUNIT_LOG_SUITE /** Informs this logger that the runner has ended a suite. * Maybe #NULL in case this logger does not implement this function. */ void(*suiteEnded)(); +#endif +#ifdef ACEUNIT_LOG_RUNNER /** Informs this logger that the runner is about to end. * Maybe #NULL in case this logger does not implement this function. */ void(*runnerEnded)(); +#endif } TestLogger_t; @@ -116,10 +182,128 @@ * @param suiteEnded Delegates to #TestLogger_t.suiteEnded. * @param runnerEnded Delegates to #TestLogger_t.runnerEnded. */ +// TODO if somebody knows a simplier way... +#if !defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE) #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + testCaseFailed\ +} +#elif !defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + testCaseStarted,\ + testCaseFailed,\ + testCaseEnded,\ +} +#elif !defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + fixtureStarted,\ + testCaseFailed,\ + fixtureEnded,\ +} +#elif !defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + fixtureStarted,\ + testCaseStarted,\ + testCaseFailed,\ + testCaseEnded,\ + fixtureEnded,\ +} +#elif !defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + suiteStarted,\ + testCaseFailed,\ + suiteEnded,\ +} +#elif !defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + suiteStarted,\ + testCaseStarted,\ + testCaseFailed,\ + testCaseEnded,\ + suiteEnded,\ +} +#elif !defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + suiteStarted,\ + fixtureStarted,\ + testCaseFailed,\ + fixtureEnded,\ + suiteEnded,\ +} +#elif !defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + suiteStarted,\ + fixtureStarted,\ + testCaseStarted,\ + testCaseFailed,\ + testCaseEnded,\ + fixtureEnded,\ + suiteEnded,\ +} +#elif defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ runnerStarted,\ + testCaseFailed,\ + runnerEnded\ +} +#elif defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + runnerStarted,\ + testCaseStarted,\ + testCaseFailed,\ + testCaseEnded,\ + runnerEnded\ +} +#elif defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + runnerStarted,\ + fixtureStarted,\ + testCaseFailed,\ + fixtureEnded,\ + runnerEnded\ +} +#elif defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + runnerStarted,\ + fixtureStarted,\ + testCaseStarted,\ + testCaseFailed,\ + testCaseEnded,\ + fixtureEnded,\ + runnerEnded\ +} +#elif defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + runnerStarted,\ suiteStarted,\ + testCaseFailed,\ + suiteEnded,\ + runnerEnded\ +} +#elif defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + runnerStarted,\ + suiteStarted,\ + testCaseStarted,\ + testCaseFailed,\ + testCaseEnded,\ + suiteEnded,\ + runnerEnded\ +} +#elif defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + runnerStarted,\ + suiteStarted,\ fixtureStarted,\ + testCaseFailed,\ + fixtureEnded,\ + suiteEnded,\ + runnerEnded\ +} +#elif defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE) +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + runnerStarted,\ + suiteStarted,\ + fixtureStarted,\ testCaseStarted,\ testCaseFailed,\ testCaseEnded,\ @@ -127,5 +311,8 @@ suiteEnded,\ runnerEnded\ } +#else +#error Internal error, missing log combination. +#endif #endif /* ACEUNITLOGGING_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 13:59:31
|
Revision: 212 http://aceunit.svn.sourceforge.net/aceunit/?rev=212&view=rev Author: christianhujer Date: 2007-11-18 05:59:34 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Improved documentation about who needs to include which header file. Modified Paths: -------------- trunk/src/native/AceUnit.h trunk/src/native/AceUnitAnnotations.h trunk/src/native/AceUnitLogging.h Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2007-11-18 13:54:55 UTC (rev 211) +++ trunk/src/native/AceUnit.h 2007-11-18 13:59:34 UTC (rev 212) @@ -30,6 +30,9 @@ #define ACEUNIT_H 1 /** AceUnit header file. + * You do not need to include this header file in a fixture. + * The generated header file for your fixture will automatically include it. + * * When using AceUnit, this is the header file that you need to include in your test fixtures. * The following options are supported: * <dl> Modified: trunk/src/native/AceUnitAnnotations.h =================================================================== --- trunk/src/native/AceUnitAnnotations.h 2007-11-18 13:54:55 UTC (rev 211) +++ trunk/src/native/AceUnitAnnotations.h 2007-11-18 13:59:34 UTC (rev 212) @@ -30,6 +30,9 @@ #define ACEUNITANNOTATIONS_H 1 /** AceUnit Annotations header file. + * You do not need to include this header file in a fixture. + * The generated header file for your fixture will automatically include it. + * * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @file AceUnitAnnotations.h */ Modified: trunk/src/native/AceUnitLogging.h =================================================================== --- trunk/src/native/AceUnitLogging.h 2007-11-18 13:54:55 UTC (rev 211) +++ trunk/src/native/AceUnitLogging.h 2007-11-18 13:59:34 UTC (rev 212) @@ -30,8 +30,10 @@ #define ACEUNITLOGGING_H 1 /** AceUnit Logging header file. - * It will be needed by loggers to declare logging and runners to use logging. - * Test fixtures do not need to include this header file. + * You do no tneed to include this header file in a fixture. + * Test fixtures do not need this header file. + * This header file is only needed by runners and loggers. + * * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @file AceUnitLogging.h */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 13:54:55
|
Revision: 211 http://aceunit.svn.sourceforge.net/aceunit/?rev=211&view=rev Author: christianhujer Date: 2007-11-18 05:54:55 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Improved documentation: there are no enforced exceptions. Modified Paths: -------------- trunk/src/native/ExceptionHandling.h Modified: trunk/src/native/ExceptionHandling.h =================================================================== --- trunk/src/native/ExceptionHandling.h 2007-11-18 13:44:17 UTC (rev 210) +++ trunk/src/native/ExceptionHandling.h 2007-11-18 13:54:55 UTC (rev 211) @@ -55,6 +55,7 @@ * - Omitting the {} block at try or catch will eventually not be detected by the compiler but lead to extremely strange behaviour. * - throw has a slightly different syntax. * - throws has a slightly different syntax and currently no effect. + * - there are no checked exceptions, i.e. exception handling cannot be enforced. * * Similarities with Java * - You can have more than one catch clause per try. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 13:44:42
|
Revision: 210 http://aceunit.svn.sourceforge.net/aceunit/?rev=210&view=rev Author: christianhujer Date: 2007-11-18 05:44:17 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Extracted logging stuff into a header file of its own. Modified Paths: -------------- trunk/src/native/AceUnit.c trunk/src/native/AceUnit.h trunk/src/native/FullPlainLogger.c trunk/src/native/JUnitXmlLogger.c trunk/src/native/MiniRamLogger.c trunk/src/native/test/basic/Makefile trunk/src/native/test/longjmp/Makefile trunk/src/native/test/xmlLog/Makefile trunk/src/native/test/xmlLog/XmlLogTest.c Added Paths: ----------- trunk/src/native/AceUnitLogging.h Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2007-11-18 13:34:05 UTC (rev 209) +++ trunk/src/native/AceUnit.c 2007-11-18 13:44:17 UTC (rev 210) @@ -31,6 +31,7 @@ */ #include "AceUnit.h" +#include "AceUnitLogging.h" #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP #include <setjmp.h> Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2007-11-18 13:34:05 UTC (rev 209) +++ trunk/src/native/AceUnit.h 2007-11-18 13:44:17 UTC (rev 210) @@ -369,94 +369,4 @@ */ extern void runFixture(const TestFixture_t *const fixture); -/** A Logger logs events during test execution. - * - * @warning When you write a logger, you should not use this structure directly. - * If you violate this rule, your logger will be much more dependant on changes to the structure than it should. - * Instead, use the macro #AceUnitNewLogger() to declare an instance of this type. - * - * @see #AceUnitNewLogger() - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -typedef struct { - - /** Informs this logger that the runner has started running. - * Maybe #NULL in case this logger does not implement this function. - */ - void(*runnerStarted)(); - - /** Informs this logger that the runner has started a suite. - * Maybe #NULL in case this logger does not implement this function. - */ - void(*suiteStarted)(); - - /** Informs this logger that the runner has started a fixture. - * Maybe #NULL in case this logger does not implement this function. - * @param fixture Fixture that was started. - */ - void(*fixtureStarted)(const FixtureId_t fixture); - - /** Informs this logger that the runner starts a test case. - * Maybe #NULL in case this logger does not implement this function. - * @param testCase Test case that was started. - */ - void(*testCaseStarted)(TestCaseId_t testCase); - - /** Informs this logger that the runner failed a test case. - * Maybe #NULL in case this logger does not implement this function. - * @param error Assertion error with error information. - */ - void(*testCaseFailed)(const AssertionError_t *error); - - /** Informs this logger that the runner ended a test case. - * This will be invoked for failed test cases as well as for successful test cases. - * Maybe #NULL in case this logger does not implement this function. - * @param testCase Test case that was ended. - */ - void(*testCaseEnded)(TestCaseId_t testCase); - - /** Informs this logger that the runner has ended a fixture. - * Maybe #NULL in case this logger does not implement this function. - * @param fixture Fixture that was ended. - */ - void(*fixtureEnded)(FixtureId_t fixture); - - /** Informs this logger that the runner has ended a suite. - * Maybe #NULL in case this logger does not implement this function. - */ - void(*suiteEnded)(); - - /** Informs this logger that the runner is about to end. - * Maybe #NULL in case this logger does not implement this function. - */ - void(*runnerEnded)(); - -} TestLogger_t; - -/** Declare a logger. - * Use this macro for declaring instance of #TestLogger_t. - * Depending on the configuration / environment, this macro may or may not use all of its parameters. - * @param name Name of the logger to declare, will create a variable with this name and of type #TestLogger_t. - * @param runnerStarted Delegates to #TestLogger_t.runnerStarted. - * @param suiteStarted Delegates to #TestLogger_t.suiteStarted. - * @param fixtureStarted Delegates to #TestLogger_t.fixtureStarted. - * @param testCaseStarted Delegates to #TestLogger_t.testCaseStarted. - * @param testCaseFailed Delegates to #TestLogger_t.testCaseFailed. - * @param testCaseEnded Delegates to #TestLogger_t.testCaseEnded. - * @param fixtureEnded Delegates to #TestLogger_t.fixtureEnded. - * @param suiteEnded Delegates to #TestLogger_t.suiteEnded. - * @param runnerEnded Delegates to #TestLogger_t.runnerEnded. - */ -#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ - runnerStarted,\ - suiteStarted,\ - fixtureStarted,\ - testCaseStarted,\ - testCaseFailed,\ - testCaseEnded,\ - fixtureEnded,\ - suiteEnded,\ - runnerEnded\ -} - #endif /* ACEUNIT_H */ Added: trunk/src/native/AceUnitLogging.h =================================================================== --- trunk/src/native/AceUnitLogging.h (rev 0) +++ trunk/src/native/AceUnitLogging.h 2007-11-18 13:44:17 UTC (rev 210) @@ -0,0 +1,129 @@ +/* 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. + */ + +#ifndef ACEUNITLOGGING_H +/** Include shield to protect the header file from being included more than once. */ +#define ACEUNITLOGGING_H 1 + +/** AceUnit Logging header file. + * It will be needed by loggers to declare logging and runners to use logging. + * Test fixtures do not need to include this header file. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @file AceUnitLogging.h + */ + +/** A Logger logs events during test execution. + * + * @warning When you write a logger, you should not use this structure directly. + * If you violate this rule, your logger will be much more dependant on changes to the structure than it should. + * Instead, use the macro #AceUnitNewLogger() to declare an instance of this type. + * + * @see #AceUnitNewLogger() + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +typedef struct { + + /** Informs this logger that the runner has started running. + * Maybe #NULL in case this logger does not implement this function. + */ + void(*runnerStarted)(); + + /** Informs this logger that the runner has started a suite. + * Maybe #NULL in case this logger does not implement this function. + */ + void(*suiteStarted)(); + + /** Informs this logger that the runner has started a fixture. + * Maybe #NULL in case this logger does not implement this function. + * @param fixture Fixture that was started. + */ + void(*fixtureStarted)(const FixtureId_t fixture); + + /** Informs this logger that the runner starts a test case. + * Maybe #NULL in case this logger does not implement this function. + * @param testCase Test case that was started. + */ + void(*testCaseStarted)(TestCaseId_t testCase); + + /** Informs this logger that the runner failed a test case. + * Maybe #NULL in case this logger does not implement this function. + * @param error Assertion error with error information. + */ + void(*testCaseFailed)(const AssertionError_t *error); + + /** Informs this logger that the runner ended a test case. + * This will be invoked for failed test cases as well as for successful test cases. + * Maybe #NULL in case this logger does not implement this function. + * @param testCase Test case that was ended. + */ + void(*testCaseEnded)(TestCaseId_t testCase); + + /** Informs this logger that the runner has ended a fixture. + * Maybe #NULL in case this logger does not implement this function. + * @param fixture Fixture that was ended. + */ + void(*fixtureEnded)(FixtureId_t fixture); + + /** Informs this logger that the runner has ended a suite. + * Maybe #NULL in case this logger does not implement this function. + */ + void(*suiteEnded)(); + + /** Informs this logger that the runner is about to end. + * Maybe #NULL in case this logger does not implement this function. + */ + void(*runnerEnded)(); + +} TestLogger_t; + +/** Declare a logger. + * Use this macro for declaring instance of #TestLogger_t. + * Depending on the configuration / environment, this macro may or may not use all of its parameters. + * @param name Name of the logger to declare, will create a variable with this name and of type #TestLogger_t. + * @param runnerStarted Delegates to #TestLogger_t.runnerStarted. + * @param suiteStarted Delegates to #TestLogger_t.suiteStarted. + * @param fixtureStarted Delegates to #TestLogger_t.fixtureStarted. + * @param testCaseStarted Delegates to #TestLogger_t.testCaseStarted. + * @param testCaseFailed Delegates to #TestLogger_t.testCaseFailed. + * @param testCaseEnded Delegates to #TestLogger_t.testCaseEnded. + * @param fixtureEnded Delegates to #TestLogger_t.fixtureEnded. + * @param suiteEnded Delegates to #TestLogger_t.suiteEnded. + * @param runnerEnded Delegates to #TestLogger_t.runnerEnded. + */ +#define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ + runnerStarted,\ + suiteStarted,\ + fixtureStarted,\ + testCaseStarted,\ + testCaseFailed,\ + testCaseEnded,\ + fixtureEnded,\ + suiteEnded,\ + runnerEnded\ +} + +#endif /* ACEUNITLOGGING_H */ Property changes on: trunk/src/native/AceUnitLogging.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/src/native/FullPlainLogger.c =================================================================== --- trunk/src/native/FullPlainLogger.c 2007-11-18 13:34:05 UTC (rev 209) +++ trunk/src/native/FullPlainLogger.c 2007-11-18 13:44:17 UTC (rev 210) @@ -39,6 +39,7 @@ #include <stdio.h> #include "AceUnit.h" +#include "AceUnitLogging.h" /** Logs a message using this logger. * @param recentError Error to log. Modified: trunk/src/native/JUnitXmlLogger.c =================================================================== --- trunk/src/native/JUnitXmlLogger.c 2007-11-18 13:34:05 UTC (rev 209) +++ trunk/src/native/JUnitXmlLogger.c 2007-11-18 13:44:17 UTC (rev 210) @@ -34,6 +34,7 @@ #include <stdlib.h> #include "AceUnit.h" +#include "AceUnitLogging.h" /** Returns the host name of the host this test is executed on. * @return Host name Modified: trunk/src/native/MiniRamLogger.c =================================================================== --- trunk/src/native/MiniRamLogger.c 2007-11-18 13:34:05 UTC (rev 209) +++ trunk/src/native/MiniRamLogger.c 2007-11-18 13:44:17 UTC (rev 210) @@ -37,6 +37,7 @@ #include <string.h> #include "AceUnit.h" +#include "AceUnitLogging.h" #ifndef ACEUNIT_EMBEDDED #error "MiniRamLogger can only be used for ACEUNIT_EMBEDDED." #endif Modified: trunk/src/native/test/basic/Makefile =================================================================== --- trunk/src/native/test/basic/Makefile 2007-11-18 13:34:05 UTC (rev 209) +++ trunk/src/native/test/basic/Makefile 2007-11-18 13:44:17 UTC (rev 210) @@ -1,7 +1,7 @@ LOGGER=FullPlainLogger #LOGGER=MiniRamLogger -ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h $(LOGGER).c AceUnit.jar +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar ACE_UNIT_PATH=../../../ @@ -28,6 +28,9 @@ AceUnitAnnotations.h: $(ACE_UNIT_PATH)/native/AceUnitAnnotations.h cp $< $@ +AceUnitLogging.h: $(ACE_UNIT_PATH)/native/AceUnitLogging.h + cp $< $@ + $(LOGGER).c: $(ACE_UNIT_PATH)/native/$(LOGGER).c cp $< $@ Modified: trunk/src/native/test/longjmp/Makefile =================================================================== --- trunk/src/native/test/longjmp/Makefile 2007-11-18 13:34:05 UTC (rev 209) +++ trunk/src/native/test/longjmp/Makefile 2007-11-18 13:44:17 UTC (rev 210) @@ -1,7 +1,7 @@ LOGGER=FullPlainLogger #LOGGER=MiniRamLogger -ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h $(LOGGER).c AceUnit.jar +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar ACE_UNIT_PATH=../../../ @@ -28,6 +28,9 @@ AceUnitAnnotations.h: $(ACE_UNIT_PATH)/native/AceUnitAnnotations.h cp $< $@ +AceUnitLogging.h: $(ACE_UNIT_PATH)/native/AceUnitLogging.h + cp $< $@ + $(LOGGER).c: $(ACE_UNIT_PATH)/native/$(LOGGER).c cp $< $@ Modified: trunk/src/native/test/xmlLog/Makefile =================================================================== --- trunk/src/native/test/xmlLog/Makefile 2007-11-18 13:34:05 UTC (rev 209) +++ trunk/src/native/test/xmlLog/Makefile 2007-11-18 13:44:17 UTC (rev 210) @@ -1,6 +1,6 @@ LOGGER=JUnitXmlLogger -ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h $(LOGGER).c AceUnit.jar +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar ACE_UNIT_PATH=../../../ @@ -27,6 +27,9 @@ AceUnitAnnotations.h: $(ACE_UNIT_PATH)/native/AceUnitAnnotations.h cp $< $@ +AceUnitLogging.h: $(ACE_UNIT_PATH)/native/AceUnitLogging.h + cp $< $@ + $(LOGGER).c: $(ACE_UNIT_PATH)/native/$(LOGGER).c cp $< $@ Modified: trunk/src/native/test/xmlLog/XmlLogTest.c =================================================================== --- trunk/src/native/test/xmlLog/XmlLogTest.c 2007-11-18 13:34:05 UTC (rev 209) +++ trunk/src/native/test/xmlLog/XmlLogTest.c 2007-11-18 13:44:17 UTC (rev 210) @@ -35,6 +35,7 @@ #include <stdio.h> #include "XmlLogTest.h" +#include "AceUnitLogging.h" A_Test void test1() { fail("Intentional failure for testing the XML Logger."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-18 13:34:26
|
Revision: 209 http://aceunit.svn.sourceforge.net/aceunit/?rev=209&view=rev Author: christianhujer Date: 2007-11-18 05:34:05 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Fixed doxygen issue - forgot to rename symbol before commit. Modified Paths: -------------- trunk/src/native/AceUnit.h Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2007-11-18 13:33:33 UTC (rev 208) +++ trunk/src/native/AceUnit.h 2007-11-18 13:34:05 UTC (rev 209) @@ -373,7 +373,7 @@ * * @warning When you write a logger, you should not use this structure directly. * If you violate this rule, your logger will be much more dependant on changes to the structure than it should. - * Instead, use the macro #declareLogger() to declare an instance of this type. + * Instead, use the macro #AceUnitNewLogger() to declare an instance of this type. * * @see #AceUnitNewLogger() * @author <a href="mailto:ch...@ri...">Christian Hujer</a> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |