aceunit-commit Mailing List for AceUnit (Page 9)
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...> - 2008-10-14 08:03:42
|
Revision: 383 http://aceunit.svn.sourceforge.net/aceunit/?rev=383&view=rev Author: christianhujer Date: 2008-10-14 08:03:29 +0000 (Tue, 14 Oct 2008) Log Message: ----------- Added config file to this example. Modified Paths: -------------- trunk/src/native/test/basicEmbedded/Makefile Added Paths: ----------- trunk/src/native/test/basicEmbedded/AceUnitConfig.h Copied: trunk/src/native/test/basicEmbedded/AceUnitConfig.h (from rev 382, trunk/src/native/test/basic/AceUnitConfig.h) =================================================================== --- trunk/src/native/test/basicEmbedded/AceUnitConfig.h (rev 0) +++ trunk/src/native/test/basicEmbedded/AceUnitConfig.h 2008-10-14 08:03:29 UTC (rev 383) @@ -0,0 +1,5 @@ +/** Let AceUnit use its own C99 definitions. */ +#define ACEUNIT_INTERNAL_ISO_TYPES + +/** Use an embedded configuration here. */ +#define ACEUNIT_EMBEDDED Property changes on: trunk/src/native/test/basicEmbedded/AceUnitConfig.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Modified: trunk/src/native/test/basicEmbedded/Makefile =================================================================== --- trunk/src/native/test/basicEmbedded/Makefile 2008-10-14 08:01:02 UTC (rev 382) +++ trunk/src/native/test/basicEmbedded/Makefile 2008-10-14 08:03:29 UTC (rev 383) @@ -8,6 +8,8 @@ FIXTURE_NAME=AceUnitTest +CFLAGS=-DACEUNIT_CONFIG_FILE=\"AceUnitConfig.h\" + all: prepare compile test clean: @@ -48,7 +50,7 @@ java -jar AceUnit.jar $(FIXTURE_NAME) runTests: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) - $(CC) -fdiagnostics-show-option -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -DACEUNIT_EMBEDDED -o runTests *.c + $(CC) $(CFLAGS) -fdiagnostics-show-option -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c test: runTests ./runTests This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-14 08:01:04
|
Revision: 382 http://aceunit.svn.sourceforge.net/aceunit/?rev=382&view=rev Author: christianhujer Date: 2008-10-14 08:01:02 +0000 (Tue, 14 Oct 2008) Log Message: ----------- Added config file to this example. Modified Paths: -------------- trunk/src/native/test/basic/Makefile Added Paths: ----------- trunk/src/native/test/basic/AceUnitConfig.h Added: trunk/src/native/test/basic/AceUnitConfig.h =================================================================== --- trunk/src/native/test/basic/AceUnitConfig.h (rev 0) +++ trunk/src/native/test/basic/AceUnitConfig.h 2008-10-14 08:01:02 UTC (rev 382) @@ -0,0 +1,2 @@ +/** Let AceUnit use its own C99 definitions. */ +#define ACEUNIT_INTERNAL_ISO_TYPES Property changes on: trunk/src/native/test/basic/AceUnitConfig.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/native/test/basic/Makefile =================================================================== --- trunk/src/native/test/basic/Makefile 2008-10-14 07:07:12 UTC (rev 381) +++ trunk/src/native/test/basic/Makefile 2008-10-14 08:01:02 UTC (rev 382) @@ -8,6 +8,8 @@ FIXTURE_NAME=AceUnitTest +CFLAGS=-DACEUNIT_CONFIG_FILE=\"AceUnitConfig.h\" + all: prepare compile test clean: @@ -48,7 +50,7 @@ java -jar AceUnit.jar $(FIXTURE_NAME) runTests: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) - $(CC) -fdiagnostics-show-option -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c + $(CC) $(CFLAGS) -fdiagnostics-show-option -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c test: runTests ./runTests This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-14 07:07:26
|
Revision: 381 http://aceunit.svn.sourceforge.net/aceunit/?rev=381&view=rev Author: christianhujer Date: 2008-10-14 07:07:12 +0000 (Tue, 14 Oct 2008) Log Message: ----------- Removed bogus commas at the end of structure initializers. Modified Paths: -------------- trunk/src/native/AceUnitLogging.h Modified: trunk/src/native/AceUnitLogging.h =================================================================== --- trunk/src/native/AceUnitLogging.h 2008-10-13 23:39:07 UTC (rev 380) +++ trunk/src/native/AceUnitLogging.h 2008-10-14 07:07:12 UTC (rev 381) @@ -191,7 +191,7 @@ #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\ testCaseStarted,\ testCaseFailed,\ - testCaseEnded,\ + 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 = {\ @@ -219,7 +219,7 @@ testCaseStarted,\ testCaseFailed,\ testCaseEnded,\ - suiteEnded,\ + 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 = {\ @@ -227,7 +227,7 @@ fixtureStarted,\ testCaseFailed,\ fixtureEnded,\ - suiteEnded,\ + 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 = {\ @@ -237,7 +237,7 @@ testCaseFailed,\ testCaseEnded,\ fixtureEnded,\ - suiteEnded,\ + 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 = {\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-13 23:39:16
|
Revision: 380 http://aceunit.svn.sourceforge.net/aceunit/?rev=380&view=rev Author: christianhujer Date: 2008-10-13 23:39:07 +0000 (Mon, 13 Oct 2008) Log Message: ----------- Extended manual to include information about what test framework means and how AceUnit is integrated and invoked. Modified Paths: -------------- trunk/src/doc/manual.xhtml Modified: trunk/src/doc/manual.xhtml =================================================================== --- trunk/src/doc/manual.xhtml 2008-10-13 23:25:36 UTC (rev 379) +++ trunk/src/doc/manual.xhtml 2008-10-13 23:39:07 UTC (rev 380) @@ -16,6 +16,26 @@ 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>What's AceUnit for you?</h2> + <p> + AceUnit is a unit test framework. + </p> + <p> + As such it provides a framework for you that you can use for writing your unit tests. + As a framework for unit testing, AceUnit provides you with a hierarchical test structure. + Test Suites consist of Test Suites (recursively) and Test Fixtures. + A Test Fixture consists of Test Cases that can have a preparation (beforeClass / before) and cleanup (afterClass / after). + AceUnit provides a Runner that will automatically traverse that hierarchical structure, run all the tests from it and log the results. + AceUnit also provides a Generator that will derive the structural information required by the Runner from some simple conventions. + The Generator replaces what in other languages (like Java) is provided by reflection. + The Runner also includes an assertion and a logging infrastructure. + </p> + <p> + The most frequent use of AceUnit is to link AceUnit and tests written for AceUnit with the testling that you want to test with AceUnit. + Because usually the testling already has a <code>main()</code> and because (unlike e.g. in Java) the testling can have only one <code>main()</code>, AceUnit does not, unlike e.g. JUnit, provide its own <code>main()</code>. + To run AceUnit, hook the invocation of the Runner in your program wherever it looks appropriate to you. + An example would be somewhere within or near <code>main()</code>, where the arguments are parsed. + </p> <h2>Quick Overview</h2> <p> Unit Tests in AceUnit are declared using annotations. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-13 23:25:45
|
Revision: 379 http://aceunit.svn.sourceforge.net/aceunit/?rev=379&view=rev Author: christianhujer Date: 2008-10-13 23:25:36 +0000 (Mon, 13 Oct 2008) Log Message: ----------- Improved documentation about ACEUNIT_ASSERTION_STYLE_RETURN. Modified Paths: -------------- trunk/src/native/AceUnit.h Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2008-10-13 23:18:17 UTC (rev 378) +++ trunk/src/native/AceUnit.h 2008-10-13 23:25:36 UTC (rev 379) @@ -223,6 +223,7 @@ * If an assertion is placed in a function invoked from a test case, the assertion error will be stored. * But the test case will not be aborted. * If another assertion occurs it will overwrite the previous assertion even before the assertion is logged. + * Also if the remaining code of the test case would run wild if the assertion failed, it will as it is not aborted. * Therefore you SHOULD NOT use this assertion style unless you really explicitely want it. * * @see #ACEUNIT_ASSERTION_STYLE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-13 23:18:21
|
Revision: 378 http://aceunit.svn.sourceforge.net/aceunit/?rev=378&view=rev Author: christianhujer Date: 2008-10-13 23:18:17 +0000 (Mon, 13 Oct 2008) Log Message: ----------- [ 1926172 ] Possible redefinition of uint16_t Modified Paths: -------------- trunk/src/native/AceUnit.h Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2008-10-13 22:19:06 UTC (rev 377) +++ trunk/src/native/AceUnit.h 2008-10-13 23:18:17 UTC (rev 378) @@ -52,7 +52,7 @@ * <li><code><stdint.h></code> for <code>uint16_t</code></li> * <li><code><stddef.h></code> for <code>NULL</code></li> * </ul> - * See also <code>ACEUNIT_SKIP_ISO_DEFINES</code> which tells AceUnit to skip the ISO defines. + * See also <code>ACEUNIT_INTERNAL_ISO_TYPES</code> which tells AceUnit to use its own ISO typedefs. * Use this if you use the ISO C99 integer types but do not get them from <code><stdint.h></code> but somewhere else. * <p> * If you use non-C99 compilers, you should bug your compiler vendor to produce an ISO/IEC 9899/1999 (aka ISO C99) compiler. @@ -177,10 +177,11 @@ * <code>A_Loop</code> support is independent of the generator. * You may turn <code>A_Loop</code> support on and off during compile time without having to rerun the generator. * </dd> - * <dt><code>ACEUNIT_SKIP_ISO_DEFINES</code></dt> + * <dt><code>ACEUNIT_INTERNAL_ISO_TYPES</code></dt> * <dd> - * This feature tells AceUnit to skip its own ISO defines. - * Use this if you do not have ISO C99 but still have your own ISO C99 type definitions and want / need to use them. + * This feature tells AceUnit to use its own ISO defines. + * Use this if you do not have ISO C99 and also do not have your own ISO C99 type definitions. + * Note: this replaces ACEUNIT_SKIP_ISO_DEFINES from previous versions of AceUnit and represents the inverted variant of that switch. * </dd> * </dl> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> @@ -195,7 +196,7 @@ #include <stddef.h> #include <stdint.h> #else -#ifndef ACEUNIT_SKIP_ISO_DEFINES +#ifdef ACEUNIT_INTERNAL_ISO_TYPES /** Replacement for stdint.h uint16_t in case stdint.h is not available. */ typedef unsigned short int uint16_t; /** Replacement for stdint.h uint32_t in case stdint.h is not available. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-13 22:19:16
|
Revision: 377 http://aceunit.svn.sourceforge.net/aceunit/?rev=377&view=rev Author: christianhujer Date: 2008-10-13 22:19:06 +0000 (Mon, 13 Oct 2008) Log Message: ----------- Minor update to AceUnitPrintf.c - removed redundant code. Modified Paths: -------------- trunk/src/native/AceUnitPrintf.c Modified: trunk/src/native/AceUnitPrintf.c =================================================================== --- trunk/src/native/AceUnitPrintf.c 2008-10-08 18:38:08 UTC (rev 376) +++ trunk/src/native/AceUnitPrintf.c 2008-10-13 22:19:06 UTC (rev 377) @@ -136,24 +136,6 @@ default: // Unknown format or flag, simply ignore it. } - } - while ((fmtChar = *format++)) { - if (fmtChar == '%') { - switch (*format++) { - case 0: - } - while (fmtChar = *format++) { - int flags = 0; - switch (fmtChar) { - case '0': - break; - } - } else { - break; - } - } else { - aceunitPutchar(fmtChar); } } -end: } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-08 18:38:11
|
Revision: 376 http://aceunit.svn.sourceforge.net/aceunit/?rev=376&view=rev Author: christianhujer Date: 2008-10-08 18:38:08 +0000 (Wed, 08 Oct 2008) Log Message: ----------- Added documentation. Modified Paths: -------------- trunk/src/native/test/loop/AceUnitLoopTest.c Modified: trunk/src/native/test/loop/AceUnitLoopTest.c =================================================================== --- trunk/src/native/test/loop/AceUnitLoopTest.c 2008-10-08 18:31:44 UTC (rev 375) +++ trunk/src/native/test/loop/AceUnitLoopTest.c 2008-10-08 18:38:08 UTC (rev 376) @@ -38,32 +38,45 @@ #include "AceUnitData.h" #include "AceUnitLoopTest.h" +/** First loop count, used for a looping test. */ static int loopCount1 = 0; +/** Second loop count, used for another looping test. */ static int loopCount2 = 0; +/** Third loop count, used for non-looping tests. */ static int loopCount3 = 0; +/** Normal test, does not loop. */ A_Test void dummy1() { loopCount3++; } +/** Looping test. */ A_Loop(5) A_Test void testLoopFeature() { loopCount1++; } +/** Normal test, does not loop. */ A_Test void dummy2() { loopCount3++; } +/** Looping test. */ A_Loop(10) A_Test void testLoopFeature2() { loopCount2++; } +/** Normal test, does not loop. */ A_Test void dummy3() { loopCount3++; } +/** Main program. + * @param argc argument count (ignored). + * @param argv argument values. + * @return Return value, 0 if the test is successful, other value if wrong. + */ int main(int argc, char *argv[]) { int retVal = 0; runFixture(&AceUnitLoopTestFixture); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-08 18:31:50
|
Revision: 375 http://aceunit.svn.sourceforge.net/aceunit/?rev=375&view=rev Author: christianhujer Date: 2008-10-08 18:31:44 +0000 (Wed, 08 Oct 2008) Log Message: ----------- Fixed bug in documentation. Modified Paths: -------------- trunk/src/native/test/comment/CommentTest.c Modified: trunk/src/native/test/comment/CommentTest.c =================================================================== --- trunk/src/native/test/comment/CommentTest.c 2008-10-06 08:21:49 UTC (rev 374) +++ trunk/src/native/test/comment/CommentTest.c 2008-10-08 18:31:44 UTC (rev 375) @@ -27,8 +27,9 @@ /** Unit Test for AceUnit. * Yes, AceUnit can be tested using itself. + * Tests that commented annotations and commented tests are properly ignored. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @file AceUnitTest.c + * @file CommentTest.c */ #include <stdbool.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-06 09:31:55
|
Revision: 373 http://aceunit.svn.sourceforge.net/aceunit/?rev=373&view=rev Author: christianhujer Date: 2008-10-06 08:18:38 +0000 (Mon, 06 Oct 2008) Log Message: ----------- Improved MethodList2 to support a default value for non-annotated methods. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java trunk/src/java/src/prj/net/sf/aceunit/MethodList.java trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java Modified: trunk/src/java/src/prj/net/sf/aceunit/Fixture.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-10-06 08:10:41 UTC (rev 372) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-10-06 08:18:38 UTC (rev 373) @@ -235,11 +235,7 @@ out.format("/** The loops of this fixture. */%n"); out.format("static const aceunit_loop_t loops[] = {%n"); for (final String method : testMethods) { - if (loopMethods.contains(method)) { - out.format(" %s,%n", loopMethods.getArg(method)); // TODO Care about last comma? - } else { - out.format(" %s,%n", "1"); // TODO Care about last comma? - } + out.format(" %s,%n", loopMethods.getArg(method)); // TODO Care about last comma? } out.format("};%n"); out.format("#endif%n"); Modified: trunk/src/java/src/prj/net/sf/aceunit/MethodList.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2008-10-06 08:10:41 UTC (rev 372) +++ trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2008-10-06 08:18:38 UTC (rev 373) @@ -147,7 +147,7 @@ * @return MethodList for A_Loop */ public static MethodList2 createLoopMethodList() { - return new MethodList2("A_Loop", "loop", "looping methods"); + return new MethodList2("A_Loop", "loop", "looping methods", "1"); } /** Modified: trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java 2008-10-06 08:10:41 UTC (rev 372) +++ trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java 2008-10-06 08:18:38 UTC (rev 373) @@ -32,6 +32,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** Special variant of MethodList which supports a parametrized annotation. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> @@ -44,16 +45,21 @@ /** The arguments. */ private final Map<String, String> args = new HashMap<String, String>(); + /** The default value returned by {@link #getArg(String)} in case no method was annotated with this annotation. */ + private final String defaultValue; + /** Create a MethodList. * The MethodList is initially empty. * Invoke {@link #findMethods(String)} to fill this MethodList. * @param annotation Annotation to find. * @param symName Name to use for symbols related to this MethodList. * @param title Title to use e.g. in comments. + * @param defaultValue Default value to return by {@link #getArg(String)} for not annotated methods. */ - public MethodList2(@NotNull final String annotation, @NotNull final String symName, @NotNull final String title) { + public MethodList2(@NotNull final String annotation, @NotNull final String symName, @NotNull final String title, @Nullable final String defaultValue) { super(annotation, symName, title); this.pattern = Pattern.compile("\\b" + annotation + "\\b\\s*\\((.*?)\\).*?(\\b\\S+?\\b)\\s*?\\(", Pattern.MULTILINE | Pattern.DOTALL); + this.defaultValue = defaultValue; } /** Finds all annotated methods in the specified C source. @@ -82,8 +88,8 @@ * @param methodName Method for which to get the loop argument. * @return Loop argument of the specified method. */ - public String getArg(@NotNull final String methodName) { - return args.get(methodName); + @Nullable public String getArg(@NotNull final String methodName) { + return args.containsKey(methodName) ? args.get(methodName) : defaultValue; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-06 08:22:53
|
Revision: 374 http://aceunit.svn.sourceforge.net/aceunit/?rev=374&view=rev Author: christianhujer Date: 2008-10-06 08:21:49 +0000 (Mon, 06 Oct 2008) Log Message: ----------- Cosmetic: Removed redundant whitespace. 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 2008-10-06 08:18:38 UTC (rev 373) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-10-06 08:21:49 UTC (rev 374) @@ -63,7 +63,7 @@ private final MethodList ignoreMethods = MethodList.createIgnoreMethodList(); /** The list of {@code @Loop} methods. */ - private final MethodList2 loopMethods = MethodList.createLoopMethodList(); + private final MethodList2 loopMethods = MethodList.createLoopMethodList(); /** All method lists for easy iteration. */ private final List<MethodList> methodLists = Arrays.asList(testMethods, beforeMethods, afterMethods, beforeClassMethods, afterClassMethods, ignoreMethods, loopMethods); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-06 08:10:53
|
Revision: 372 http://aceunit.svn.sourceforge.net/aceunit/?rev=372&view=rev Author: christianhujer Date: 2008-10-06 08:10:41 +0000 (Mon, 06 Oct 2008) Log Message: ----------- Fixed bug: The loops max for the loop feature was not generated matching the test cases. 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 2008-10-06 08:09:16 UTC (rev 371) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-10-06 08:10:41 UTC (rev 372) @@ -234,8 +234,12 @@ out.format("#ifdef ACEUNIT_LOOP%n"); out.format("/** The loops of this fixture. */%n"); out.format("static const aceunit_loop_t loops[] = {%n"); - for (final String method : loopMethods) { - out.format(" %s,%n", loopMethods.getArg(method)); // TODO Care about last comma? + for (final String method : testMethods) { + if (loopMethods.contains(method)) { + out.format(" %s,%n", loopMethods.getArg(method)); // TODO Care about last comma? + } else { + out.format(" %s,%n", "1"); // TODO Care about last comma? + } } out.format("};%n"); out.format("#endif%n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-06 08:09:21
|
Revision: 371 http://aceunit.svn.sourceforge.net/aceunit/?rev=371&view=rev Author: christianhujer Date: 2008-10-06 08:09:16 +0000 (Mon, 06 Oct 2008) Log Message: ----------- Improved loop test to include a mixture of loops and normal tests. Modified Paths: -------------- trunk/src/native/test/loop/AceUnitLoopTest.c Modified: trunk/src/native/test/loop/AceUnitLoopTest.c =================================================================== --- trunk/src/native/test/loop/AceUnitLoopTest.c 2008-10-06 08:07:37 UTC (rev 370) +++ trunk/src/native/test/loop/AceUnitLoopTest.c 2008-10-06 08:09:16 UTC (rev 371) @@ -38,12 +38,32 @@ #include "AceUnitData.h" #include "AceUnitLoopTest.h" -static int loopCount = 0; +static int loopCount1 = 0; +static int loopCount2 = 0; + +static int loopCount3 = 0; + +A_Test void dummy1() { + loopCount3++; +} + A_Loop(5) A_Test void testLoopFeature() { - loopCount++; + loopCount1++; } +A_Test void dummy2() { + loopCount3++; +} + +A_Loop(10) A_Test void testLoopFeature2() { + loopCount2++; +} + +A_Test void dummy3() { + loopCount3++; +} + int main(int argc, char *argv[]) { int retVal = 0; runFixture(&AceUnitLoopTestFixture); @@ -51,6 +71,17 @@ fprintf(stderr, "Test Cases: %d Errors: %d\n", runnerData->testCaseCount, runnerData->testCaseFailureCount); retVal = 1; } - printf("%d\n", loopCount); + if (loopCount1 != 5) { + fprintf(stderr, "Loops #1 expected: 5, loops actual: %d\n", loopCount1); + retVal = 1; + } + if (loopCount2 != 10) { + fprintf(stderr, "Loops #2 expected: 10, loops actual: %d\n", loopCount2); + retVal = 1; + } + if (loopCount3 != 3) { + fprintf(stderr, "Loops #3 expected: 3, loops actual: %d\n", loopCount3); + retVal = 1; + } return retVal; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-06 08:07:51
|
Revision: 370 http://aceunit.svn.sourceforge.net/aceunit/?rev=370&view=rev Author: christianhujer Date: 2008-10-06 08:07:37 +0000 (Mon, 06 Oct 2008) Log Message: ----------- Added loop test to test collection. Modified Paths: -------------- trunk/src/native/test/Makefile Modified: trunk/src/native/test/Makefile =================================================================== --- trunk/src/native/test/Makefile 2008-10-05 23:16:34 UTC (rev 369) +++ trunk/src/native/test/Makefile 2008-10-06 08:07:37 UTC (rev 370) @@ -4,6 +4,7 @@ comment \ exhand \ longjmp \ + loop \ recursive \ twoFixtures \ xmlLog \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 23:16:37
|
Revision: 369 http://aceunit.svn.sourceforge.net/aceunit/?rev=369&view=rev Author: christianhujer Date: 2008-10-05 23:16:34 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Updated year in LICENSE. Modified Paths: -------------- trunk/LICENSE Modified: trunk/LICENSE =================================================================== --- trunk/LICENSE 2008-10-05 23:14:14 UTC (rev 368) +++ trunk/LICENSE 2008-10-05 23:16:34 UTC (rev 369) @@ -1,4 +1,4 @@ -Copyright (c) 2007, Christian Hujer +Copyright (c) 2007-2008, Christian Hujer All rights reserved. Redistribution and use in source and binary forms, with or without This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 23:14:19
|
Revision: 368 http://aceunit.svn.sourceforge.net/aceunit/?rev=368&view=rev Author: christianhujer Date: 2008-10-05 23:14:14 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Created test for loop feature. For that simple test, the loop feature works now. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java trunk/src/java/src/prj/net/sf/aceunit/MethodList.java trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java trunk/src/native/AceUnit.c trunk/src/native/AceUnit.h Added Paths: ----------- trunk/src/native/test/loop/ trunk/src/native/test/loop/AceUnitLoopTest.c trunk/src/native/test/loop/Makefile Modified: trunk/src/java/src/prj/net/sf/aceunit/Fixture.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-10-05 23:12:01 UTC (rev 367) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-10-05 23:14:14 UTC (rev 368) @@ -66,7 +66,7 @@ private final MethodList2 loopMethods = MethodList.createLoopMethodList(); /** All method lists for easy iteration. */ - private final List<MethodList> methodLists = Arrays.asList(testMethods, beforeMethods, afterMethods, beforeClassMethods, afterClassMethods, ignoreMethods); + private final List<MethodList> methodLists = Arrays.asList(testMethods, beforeMethods, afterMethods, beforeClassMethods, afterClassMethods, ignoreMethods, loopMethods); /** All method lists for used methods for easy iteration. */ private final List<MethodList> usedMethodLists = Arrays.asList(testMethods, beforeMethods, afterMethods, beforeClassMethods, afterClassMethods); @@ -234,7 +234,7 @@ out.format("#ifdef ACEUNIT_LOOP%n"); out.format("/** The loops of this fixture. */%n"); out.format("static const aceunit_loop_t loops[] = {%n"); - for (final String method : testMethods) { + for (final String method : loopMethods) { out.format(" %s,%n", loopMethods.getArg(method)); // TODO Care about last comma? } out.format("};%n"); Modified: trunk/src/java/src/prj/net/sf/aceunit/MethodList.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2008-10-05 23:12:01 UTC (rev 367) +++ trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2008-10-05 23:14:14 UTC (rev 368) @@ -83,7 +83,7 @@ */ public MethodList(@NotNull final String annotation, @NotNull final String symName, @NotNull final String title) { this.annotation = annotation; - this.pattern = Pattern.compile("\\b" + annotation + "\\b.*?(\\b\\S+?\\b)\\s*?\\(", Pattern.MULTILINE | Pattern.DOTALL); + this.pattern = Pattern.compile("\\b" + annotation + "\\b.*?(?:A_Loop\\(.*?\\))?.*?(\\b\\S+?\\b)\\s*?\\(", Pattern.MULTILINE | Pattern.DOTALL); this.symName = symName; this.title = title; } Modified: trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java 2008-10-05 23:12:01 UTC (rev 367) +++ trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java 2008-10-05 23:14:14 UTC (rev 368) @@ -53,7 +53,7 @@ */ public MethodList2(@NotNull final String annotation, @NotNull final String symName, @NotNull final String title) { super(annotation, symName, title); - this.pattern = Pattern.compile("\\b" + annotation + "\\b\\s*(\\(.*?\\))?.*?(\\b\\S+?\\b)\\s*?\\(", Pattern.MULTILINE | Pattern.DOTALL); + this.pattern = Pattern.compile("\\b" + annotation + "\\b\\s*\\((.*?)\\).*?(\\b\\S+?\\b)\\s*?\\(", Pattern.MULTILINE | Pattern.DOTALL); } /** Finds all annotated methods in the specified C source. Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2008-10-05 23:12:01 UTC (rev 367) +++ trunk/src/native/AceUnit.c 2008-10-05 23:14:14 UTC (rev 368) @@ -89,7 +89,13 @@ #ifdef ACEUNIT_POST_BEFORECLASS ACEUNIT_POST_BEFORECLASS #endif - for (testCase = fixture->testCase, testId = fixture->testId; NULL != *testCase; testCase++, testId++) { + for (testCase = fixture->testCase, +#ifdef ACEUNIT_LOOP + loopMax = fixture->loops, +#endif + testId = fixture->testId; + NULL != *testCase; + testCase++, testId++) { runnerData->currentTestId = *testId; #ifdef ACEUNIT_LOG_TESTCASE globalLog(testCaseStarted, runnerData->currentTestId); @@ -109,7 +115,7 @@ if (!(setjmp(aceunitJmpBuf))) { #endif #ifdef ACEUNIT_LOOP - for (loopCount = 0; (loopCount < *loopMax) && (NULL == runnerdata->recenterror); loopCount++) { + for (currentLoop = 0; (currentLoop < *loopMax) && (NULL == runnerData->recentError); currentLoop++) { #endif (*testCase)(); #ifdef ACEUNIT_LOOP Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2008-10-05 23:12:01 UTC (rev 367) +++ trunk/src/native/AceUnit.h 2008-10-05 23:14:14 UTC (rev 368) @@ -492,6 +492,11 @@ } TestSuite_t; +#ifdef ACEUNIT_LOOP +/** Type for a loop in AceUnit. */ +typedef uint16_t aceunit_loop_t; +#endif + /** A Fixture is a collection of test cases sharing the same before, after, beforeClass and afterClass methods. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ @@ -512,6 +517,11 @@ /** The ids of the test cases of this test fixture. */ const TestCaseId_t *const testId; +#ifdef ACEUNIT_LOOP + /** The test cases that shall be looped. */ + const aceunit_loop_t *const loops; +#endif + /** The test cases of this test fixture. */ const testMethod_t *const testCase; Added: trunk/src/native/test/loop/AceUnitLoopTest.c =================================================================== --- trunk/src/native/test/loop/AceUnitLoopTest.c (rev 0) +++ trunk/src/native/test/loop/AceUnitLoopTest.c 2008-10-05 23:14:14 UTC (rev 368) @@ -0,0 +1,56 @@ +/* Copyright (c) 2008, 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's Loop feature. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @file AceUnitLoopTest.c + */ + +#include <stdbool.h> +#include <stdio.h> + +#define ACEUNIT_ASSERTION_STYLE ACEUNIT_ASSERTION_STYLE_RETURN + +#include "AceUnitData.h" +#include "AceUnitLoopTest.h" + +static int loopCount = 0; + +A_Loop(5) A_Test void testLoopFeature() { + loopCount++; +} + +int main(int argc, char *argv[]) { + int retVal = 0; + runFixture(&AceUnitLoopTestFixture); + if (runnerData->testCaseFailureCount != 0) { + fprintf(stderr, "Test Cases: %d Errors: %d\n", runnerData->testCaseCount, runnerData->testCaseFailureCount); + retVal = 1; + } + printf("%d\n", loopCount); + return retVal; +} Property changes on: trunk/src/native/test/loop/AceUnitLoopTest.c ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/native/test/loop/Makefile =================================================================== --- trunk/src/native/test/loop/Makefile (rev 0) +++ trunk/src/native/test/loop/Makefile 2008-10-05 23:14:14 UTC (rev 368) @@ -0,0 +1,60 @@ +LOGGER=FullPlainLogger + +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitData.h AceUnitData.h 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_NAME=AceUnitLoopTest + +all: prepare compile test + +clean: + rm -f $(ACE_UNIT_FILES) $(FIXTURE_NAME).h 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 $< $@ + +AceUnitData.h: $(ACE_UNIT_PATH)/native/AceUnitData.h + 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 + +$(FIXTURE_NAME).h: AceUnit.jar $(FIXTURE_NAME).c + java -jar AceUnit.jar $(FIXTURE_NAME) + +runTests: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) + $(CC) -DACEUNIT_LOOP -fdiagnostics-show-option -std=c89 -pedantic -fprofile-arcs -ftest-coverage -Wall -g -o runTests *.c + +test: runTests + ./runTests + +doc: $(FIXTURE_NAME).c $(FIXTURE_NAME).h $(ACE_UNIT_FILES) + doxygen + +coverage: test + gcov *.c Property changes on: trunk/src/native/test/loop/Makefile ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 23:12:08
|
Revision: 367 http://aceunit.svn.sourceforge.net/aceunit/?rev=367&view=rev Author: christianhujer Date: 2008-10-05 23:12:01 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Disabled printf run in overall test run until printf test works. Modified Paths: -------------- trunk/src/native/test/Makefile trunk/src/native/test/printf/Makefile Modified: trunk/src/native/test/Makefile =================================================================== --- trunk/src/native/test/Makefile 2008-10-05 22:08:24 UTC (rev 366) +++ trunk/src/native/test/Makefile 2008-10-05 23:12:01 UTC (rev 367) @@ -4,10 +4,10 @@ comment \ exhand \ longjmp \ - printf \ recursive \ twoFixtures \ xmlLog \ +# printf \ all: @for dir in $(DIRS) ; do (cd $$dir ; make) || exit 1 ; done Modified: trunk/src/native/test/printf/Makefile =================================================================== --- trunk/src/native/test/printf/Makefile 2008-10-05 22:08:24 UTC (rev 366) +++ trunk/src/native/test/printf/Makefile 2008-10-05 23:12:01 UTC (rev 367) @@ -6,7 +6,7 @@ ACE_UNIT_JAVA_SRC=$(shell find $(ACE_UNIT_PATH)/java/src -name "*.java") -FIXTURE_NAME=AceUnitTest +FIXTURE_NAME=AceUnitPrintfTest all: prepare compile test This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 22:08:27
|
Revision: 366 http://aceunit.svn.sourceforge.net/aceunit/?rev=366&view=rev Author: christianhujer Date: 2008-10-05 22:08:24 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Fixed too restircted access to methodList - MethodList2 needs it. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/MethodList.java Modified: trunk/src/java/src/prj/net/sf/aceunit/MethodList.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2008-10-05 21:42:21 UTC (rev 365) +++ trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2008-10-05 22:08:24 UTC (rev 366) @@ -63,7 +63,7 @@ /** The names of the methods found to be annotated. */ @NotNull - private final List<String> methodNames = new ArrayList<String>(); + protected final List<String> methodNames = new ArrayList<String>(); /** The arguments of the annotations. */ @NotNull private final List<String> annotParams = new ArrayList<String>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 21:42:23
|
Revision: 365 http://aceunit.svn.sourceforge.net/aceunit/?rev=365&view=rev Author: christianhujer Date: 2008-10-05 21:42:21 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Implemented generation of header information for loops. (Experimental!) 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/java/src/prj/net/sf/aceunit/MethodList2.java Modified: trunk/src/java/src/prj/net/sf/aceunit/Fixture.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-10-05 21:35:49 UTC (rev 364) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-10-05 21:42:21 UTC (rev 365) @@ -62,6 +62,9 @@ /** The list of {@code @Ignore} methods. */ private final MethodList ignoreMethods = MethodList.createIgnoreMethodList(); + /** The list of {@code @Loop} methods. */ + private final MethodList2 loopMethods = MethodList.createLoopMethodList(); + /** All method lists for easy iteration. */ private final List<MethodList> methodLists = Arrays.asList(testMethods, beforeMethods, afterMethods, beforeClassMethods, afterClassMethods, ignoreMethods); @@ -143,6 +146,7 @@ out.format("%s%n", getPrototypes()); out.format("%s%n", getTestMethodIds()); + out.format("%s%n", getTestLoops()); for (final MethodList methods : usedMethodLists) { out.format("%s%n", methods.getFunctionPointerList()); @@ -169,6 +173,9 @@ out.format(" NULL,%n"); out.format("#endif%n"); out.format(" testId,%n"); + out.format("#ifdef ACEUNIT_LOOP%n"); + out.format(" loops,%n"); + out.format("#endif%n"); out.format(" testCases,%n"); out.format(" before,%n"); out.format(" after,%n"); @@ -219,4 +226,20 @@ return out.toString(); } + /** Returns a String with the loop information for the test method ids. + * @return Source code with the loop informatino. + */ + public String getTestLoops() { + final Formatter out = new Formatter(); + out.format("#ifdef ACEUNIT_LOOP%n"); + out.format("/** The loops of this fixture. */%n"); + out.format("static const aceunit_loop_t loops[] = {%n"); + for (final String method : testMethods) { + out.format(" %s,%n", loopMethods.getArg(method)); // TODO Care about last comma? + } + out.format("};%n"); + out.format("#endif%n"); + return out.toString(); + } + } // class MethodLists Modified: trunk/src/java/src/prj/net/sf/aceunit/MethodList.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2008-10-05 21:35:49 UTC (rev 364) +++ trunk/src/java/src/prj/net/sf/aceunit/MethodList.java 2008-10-05 21:42:21 UTC (rev 365) @@ -1,4 +1,4 @@ -/* Copyright (c) 2007, Christian Hujer +/* Copyright (c) 2007 - 2008, Christian Hujer * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,13 +65,16 @@ @NotNull private final List<String> methodNames = new ArrayList<String>(); + /** The arguments of the annotations. */ + @NotNull private final List<String> annotParams = new ArrayList<String>(); + /** The unmodifiable view of {@link #methodNames}. */ @NotNull private final Collection<String> unmodifiableMethodNames = Collections.unmodifiableCollection(methodNames); /** * Create a MethodList. - * The MethodListis initially empty. + * The MethodList is initially empty. * Invoke {@link #findMethods(String)} to fill this MethodList. * * @param annotation Annotation to find. @@ -140,6 +143,14 @@ } /** + * Creates a MethodList for A_Loop. + * @return MethodList for A_Loop + */ + public static MethodList2 createLoopMethodList() { + return new MethodList2("A_Loop", "loop", "looping methods"); + } + + /** * Returns the annotation this MethodList was created for. * * @return The annotation this MethodList was created for. Added: trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java (rev 0) +++ trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java 2008-10-05 21:42:21 UTC (rev 365) @@ -0,0 +1,89 @@ +/* Copyright (c) 2008, Christian Hujer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the AceUnit developers nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.sf.aceunit; + +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.jetbrains.annotations.NotNull; + +/** Special variant of MethodList which supports a parametrized annotation. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class MethodList2 extends MethodList { + + /** The regular expression to use for fidning annotated methods. */ + @NotNull private final Pattern pattern; + + /** The arguments. */ + private final Map<String, String> args = new HashMap<String, String>(); + + /** Create a MethodList. + * The MethodList is initially empty. + * Invoke {@link #findMethods(String)} to fill this MethodList. + * @param annotation Annotation to find. + * @param symName Name to use for symbols related to this MethodList. + * @param title Title to use e.g. in comments. + */ + public MethodList2(@NotNull final String annotation, @NotNull final String symName, @NotNull final String title) { + super(annotation, symName, title); + this.pattern = Pattern.compile("\\b" + annotation + "\\b\\s*(\\(.*?\\))?.*?(\\b\\S+?\\b)\\s*?\\(", Pattern.MULTILINE | Pattern.DOTALL); + } + + /** Finds all annotated methods in the specified C source. + * @param cSource C source to search. + */ + public void findMethods(@NotNull final String cSource) { + methodNames.clear(); + args.clear(); + final Matcher matcher = pattern.matcher(cSource); + while (matcher.find()) { + final String methodName = matcher.group(2); + methodNames.add(methodName); + String arg = matcher.group(1); + if (arg == null) { + arg = ""; + } + arg = arg.trim(); + if (arg.length() == 0) { + arg = "1"; + } + args.put(methodName, arg); + } + } + + /** Returns the loop annotation argument of the specified method. + * @param methodName Method for which to get the loop argument. + * @return Loop argument of the specified method. + */ + public String getArg(@NotNull final String methodName) { + return args.get(methodName); + } + +} Property changes on: trunk/src/java/src/prj/net/sf/aceunit/MethodList2.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 21:35:53
|
Revision: 364 http://aceunit.svn.sourceforge.net/aceunit/?rev=364&view=rev Author: christianhujer Date: 2008-10-05 21:35:49 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Cosmetic. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/SourceFiles.java Modified: trunk/src/java/src/prj/net/sf/aceunit/SourceFiles.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/SourceFiles.java 2008-10-05 21:30:13 UTC (rev 363) +++ trunk/src/java/src/prj/net/sf/aceunit/SourceFiles.java 2008-10-05 21:35:49 UTC (rev 364) @@ -77,7 +77,7 @@ * * @param file File of the source to read. * @return String with the contents of the specified file. - * @throws java.io.IOException in case of I/O problems. + * @throws IOException in case of I/O problems. */ public static String readSource(@NotNull final File file) throws IOException { final Reader in = new FileReader(file); @@ -95,7 +95,7 @@ * * @param file File of the source to read. * @return String with the contents of the specified file. - * @throws java.io.IOException in case of I/O problems. + * @throws IOException in case of I/O problems. */ public static String readSourceWithoutComments(@NotNull final File file) throws IOException { final Reader in = new CommentToWhitespaceReader(new BufferedReader(new FileReader(file))); @@ -114,7 +114,7 @@ * @param file File to write to. * @param text String to write to the file. * @param force Set this to true if a write protection from the file should be removed. - * @throws java.io.IOException In case of I/O problems. + * @throws IOException In case of I/O problems. */ public static void writeIfChanged(@NotNull final File file, @NotNull final String text, final boolean force) throws IOException { if (!file.exists() || !text.equals(readSource(file))) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 21:30:15
|
Revision: 363 http://aceunit.svn.sourceforge.net/aceunit/?rev=363&view=rev Author: christianhujer Date: 2008-10-05 21:30:13 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Workaround for IntelliJ IDEA to make FixtureTest run with IntelliJ IDEA's JUnit Test Runner. Modified Paths: -------------- trunk/src/java/src/tst/test/net/sf/aceunit/FixtureTest.java Modified: trunk/src/java/src/tst/test/net/sf/aceunit/FixtureTest.java =================================================================== --- trunk/src/java/src/tst/test/net/sf/aceunit/FixtureTest.java 2008-10-05 21:29:04 UTC (rev 362) +++ trunk/src/java/src/tst/test/net/sf/aceunit/FixtureTest.java 2008-10-05 21:30:13 UTC (rev 363) @@ -28,6 +28,7 @@ package test.net.sf.aceunit; import net.sf.aceunit.Fixture; +import org.junit.Test; /** Unit Test for {@link Fixture}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> @@ -39,4 +40,8 @@ return new Fixture(id, ""); } + /** Dummy Test to workaround a bug in IntelliJ IDEA. */ + @Test public void dummy() { + } + } // class MethodListsTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 21:29:08
|
Revision: 362 http://aceunit.svn.sourceforge.net/aceunit/?rev=362&view=rev Author: christianhujer Date: 2008-10-05 21:29:04 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Improved CommentToWhitespaceReaderTest to test with LF, CRLF and CR. Modified Paths: -------------- trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java Modified: trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java =================================================================== --- trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java 2008-10-05 21:27:06 UTC (rev 361) +++ trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java 2008-10-05 21:29:04 UTC (rev 362) @@ -43,61 +43,177 @@ /** Tests that for source code without comments, that source code is returned unmodified. * @throws IOException In case of I/O problems (unexpected). */ - @Test public void simple() throws IOException { + @Test public void simpleLF() throws IOException { final String orig = "void foo() {\n bar();\n}\n"; assertReplacement(orig, orig); } + /** Tests that for source code without comments, that source code is returned unmodified. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void simpleCR() throws IOException { + final String orig = "void foo() {\r bar();\r}\r"; + assertReplacement(orig, orig); + } + + /** Tests that for source code without comments, that source code is returned unmodified. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void simpleCRLF() throws IOException { + final String orig = "void foo() {\r\n bar();\r\n}\r\n"; + assertReplacement(orig, orig); + } + /** Tests that EOL comments are properly replaced by whitespace. * @throws IOException In case of I/O problems (unexpected). */ - @Test public void eolComments() throws IOException { + @Test public void eolCommentsLF() throws IOException { final String orig = "void foo() { // comment\n bar(); // comment\n} // comment\n"; final String expe = "void foo() { \n bar(); \n} \n"; assertReplacement(orig, expe); } + /** Tests that EOL comments are properly replaced by whitespace. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void eolCommentsCR() throws IOException { + final String orig = "void foo() { // comment\r bar(); // comment\r} // comment\r"; + final String expe = "void foo() { \r bar(); \r} \r"; + assertReplacement(orig, expe); + } + + /** Tests that EOL comments are properly replaced by whitespace. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void eolCommentsCRLF() throws IOException { + final String orig = "void foo() { // comment\r\n bar(); // comment\r\n} // comment\r\n"; + final String expe = "void foo() { \r\n bar(); \r\n} \r\n"; + assertReplacement(orig, expe); + } + /** Tests that multiline comments on a single line are properly replaced by whitespace. * @throws IOException In case of I/O problems (unexpected). */ - @Test public void multilineComments() throws IOException { + @Test public void multilineCommentsLF() throws IOException { final String orig = "void foo() { /* comment */\n bar(); /* comment */\n} /* comment */\n"; final String expe = "void foo() { \n bar(); \n} \n"; assertReplacement(orig, expe); } + /** Tests that multiline comments on a single line are properly replaced by whitespace. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void multilineCommentsCR() throws IOException { + final String orig = "void foo() { /* comment */\r bar(); /* comment */\r} /* comment */\r"; + final String expe = "void foo() { \r bar(); \r} \r"; + assertReplacement(orig, expe); + } + + /** Tests that multiline comments on a single line are properly replaced by whitespace. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void multilineCommentsCRLF() throws IOException { + final String orig = "void foo() { /* comment */\r\n bar(); /* comment */\r\n} /* comment */\r\n"; + final String expe = "void foo() { \r\n bar(); \r\n} \r\n"; + assertReplacement(orig, expe); + } + /** Tests that a String that contains text like an EOL comment is retained as String. * @throws IOException In case of I/O problems (unexpected). */ - @Test public void pseudoEolCommentInString() throws IOException { + @Test public void pseudoEolCommentInStringLF() throws IOException { final String orig = "void foo() {\n printf(\"// pseudocomment\");\n}\n"; assertReplacement(orig, orig); } + /** Tests that a String that contains text like an EOL comment is retained as String. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void pseudoEolCommentInStringCR() throws IOException { + final String orig = "void foo() {\r printf(\"// pseudocomment\");\r}\r"; + assertReplacement(orig, orig); + } + + /** Tests that a String that contains text like an EOL comment is retained as String. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void pseudoEolCommentInStringCRLF() throws IOException { + final String orig = "void foo() {\r\n printf(\"// pseudocomment\");\r\n}\r\n"; + assertReplacement(orig, orig); + } + /** Tests that a String that contains text like a multiline comment is retained as String. * @throws IOException In case of I/O problems (unexpected). */ - @Test public void pseudoMultilineCommentInString() throws IOException { + @Test public void pseudoMultilineCommentInStringLF() throws IOException { final String orig = "void foo() {\n printf(\"/* pseudocomment */\");\n}\n"; assertReplacement(orig, orig); } + /** Tests that a String that contains text like a multiline comment is retained as String. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void pseudoMultilineCommentInStringCR() throws IOException { + final String orig = "void foo() {\r printf(\"/* pseudocomment */\");\r}\r"; + assertReplacement(orig, orig); + } + + /** Tests that a String that contains text like a multiline comment is retained as String. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void pseudoMultilineCommentInStringCRLF() throws IOException { + final String orig = "void foo() {\r\n printf(\"/* pseudocomment */\");\r\n}\r\n"; + assertReplacement(orig, orig); + } + /** Tests that a single slash at the end of a line is not removed. * @throws IOException In case of I/O problems (unexpected). */ - @Test public void slashAtEndOfLine() throws IOException { + @Test public void slashAtEndOfLineCR() throws IOException { final String orig = "someCode(); /\nfoo();\n"; assertReplacement(orig, orig); } + /** Tests that a single slash at the end of a line is not removed. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void slashAtEndOfLineLF() throws IOException { + final String orig = "someCode(); /\rfoo();\r"; + assertReplacement(orig, orig); + } + + /** Tests that a single slash at the end of a line is not removed. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void slashAtEndOfLineCRLF() throws IOException { + final String orig = "someCode(); /\r\nfoo();\r\n"; + assertReplacement(orig, orig); + } + /** Tests that a single slash at the end and start of line are not removed. * @throws IOException In case of I/O problems (unexpected). */ - @Test public void slashAtEndAndStartOfLine() throws IOException { + @Test public void slashAtEndAndStartOfLineLF() throws IOException { final String orig = "someCode(); /\n/ foo();\n"; assertReplacement(orig, orig); } + /** Tests that a single slash at the end and start of line are not removed. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void slashAtEndAndStartOfLineCR() throws IOException { + final String orig = "someCode(); /\r/ foo();\r"; + assertReplacement(orig, orig); + } + + /** Tests that a single slash at the end and start of line are not removed. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void slashAtEndAndStartOfLineCRLF() throws IOException { + final String orig = "someCode(); /\r\n/ foo();\r\n"; + assertReplacement(orig, orig); + } + /** Tests that a single slash at the end of a file is not removed. * @throws IOException In case of I/O problems (unexpected). * @see <a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1879533&group_id=207094&atid=1000227">[ 1879533 ] missing EOL at EOF makes Generator run out of heap space</a> @@ -110,21 +226,57 @@ /** Tests that a multiline comment at the start of the text is replaced by whitespace. * @throws IOException In case of I/O problems (unexpected). */ - @Test public void eolCommentAtStart() throws IOException { + @Test public void eolCommentAtStartLF() throws IOException { final String orig = "/* foo\n * bar\n *\n */\n\nextern void foo();\n"; final String expe = " \n \n \n \n\nextern void foo();\n"; assertReplacement(orig, expe); } + /** Tests that a multiline comment at the start of the text is replaced by whitespace. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void eolCommentAtStartCR() throws IOException { + final String orig = "/* foo\r * bar\r *\r */\r\rextern void foo();\r"; + final String expe = " \r \r \r \r\rextern void foo();\r"; + assertReplacement(orig, expe); + } + + /** Tests that a multiline comment at the start of the text is replaced by whitespace. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void eolCommentAtStartCRLF() throws IOException { + final String orig = "/* foo\r\n * bar\r\n *\r\n */\r\n\r\nextern void foo();\r\n"; + final String expe = " \r\n \r\n \r\n \r\n\r\nextern void foo();\r\n"; + assertReplacement(orig, expe); + } + /** Tests that consecutive single line comments at the start of the text are replaced by whitespace. * @throws IOException In case of I/O problems (unexpected). */ - @Test public void multilineCommentAtStart() throws IOException { + @Test public void multilineCommentAtStartLF() throws IOException { final String orig = "// foo\n// bar\n// bazz\nextern void foo();\n"; final String expe = " \n \n \nextern void foo();\n"; assertReplacement(orig, expe); } + /** Tests that consecutive single line comments at the start of the text are replaced by whitespace. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void multilineCommentAtStartCR() throws IOException { + final String orig = "// foo\r// bar\r// bazz\rextern void foo();\r"; + final String expe = " \r \r \rextern void foo();\r"; + assertReplacement(orig, expe); + } + + /** Tests that consecutive single line comments at the start of the text are replaced by whitespace. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void multilineCommentAtStartCRLF() throws IOException { + final String orig = "// foo\r\n// bar\r\n// bazz\r\nextern void foo();\r\n"; + final String expe = " \r\n \r\n \r\nextern void foo();\r\n"; + assertReplacement(orig, expe); + } + /** Tests that an incomplete last line works. * @throws IOException In case of I/O problems (unexpected). * @see <a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1879533&group_id=207094&atid=1000227">[ 1879533 ] missing EOL at EOF makes Generator run out of heap space</a> @@ -195,6 +347,61 @@ assertReplacement(orig, expe); } + /** Tests that stars in multiline comments do not cause problems. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void starsInMultilineComment() throws IOException { + final String orig = "foo/***/foo"; + final String expe = "foo foo"; + assertReplacement(orig, expe); + } + + /** Tests that a slash in the next line does not terminate a multiline comment. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void slashInNextLineDoesNotTerminateLF() throws IOException { + final String orig = "foo/*\n/*/bar/**\n/*/"; + final String expe = "foo \n bar \n "; + assertReplacement(orig, expe); + } + + /** Tests that a slash in the next line does not terminate a multiline comment. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void slashInNextLineDoesNotTerminateCR() throws IOException { + final String orig = "foo/*\r/*/bar/**\r/*/"; + final String expe = "foo \r bar \r "; + assertReplacement(orig, expe); + } + + /** Tests that a slash in the next line does not terminate a multiline comment. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void slashInNextLineDoesNotTerminateCRLF() throws IOException { + final String orig = "foo/*\r\n/*/bar/**\r\n/*/"; + final String expe = "foo \r\n bar \r\n "; + assertReplacement(orig, expe); + } + + /** Tests that escapes in Strings work. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void escapeInString() throws IOException { + final String orig = "foo\"\\\"\\/\"bar"; + final String expe = "foo\"\\\"\\/\"bar"; + assertReplacement(orig, expe); + } + + /** Tests that escapes in Characters work. + * This is not correct C but valid for a C preprocessor. + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void escapeInCharacter() throws IOException { + final String orig = "foo\'\\\'\\/\'bar"; + final String expe = "foo\'\\\'\\/\'bar"; + assertReplacement(orig, expe); + } + /** Asserts that when reading the String <var>orig</var> through a {@link CommentToWhitespaceReader}, <var>expe</var> is returned. * @param orig Original String, will be passed through a {@link CommentToWhitespaceReader}. * @param expe Expected String, will be compared to the result of passing <var>orig</var> through a {@link CommentToWhitespaceReader}. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 21:27:09
|
Revision: 361 http://aceunit.svn.sourceforge.net/aceunit/?rev=361&view=rev Author: christianhujer Date: 2008-10-05 21:27:06 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Improved test about distinct ids. Modified Paths: -------------- trunk/src/java/src/tst/test/net/sf/aceunit/IdGeneratorTest.java Modified: trunk/src/java/src/tst/test/net/sf/aceunit/IdGeneratorTest.java =================================================================== --- trunk/src/java/src/tst/test/net/sf/aceunit/IdGeneratorTest.java 2008-10-05 21:20:00 UTC (rev 360) +++ trunk/src/java/src/tst/test/net/sf/aceunit/IdGeneratorTest.java 2008-10-05 21:27:06 UTC (rev 361) @@ -4,6 +4,8 @@ import org.junit.Test; import org.junit.Assert; +import java.util.Arrays; + /** UnitTest for {@link IdGenerator}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ @@ -13,7 +15,14 @@ @Test public void testDistinct() { final IdGenerator testling = new IdGenerator(); - Assert.assertFalse("IdGenerator MUST return distinct ids.", testling.getNextId() == testling.getNextId()); + final int[] testArray = new int[1000]; + for (int i = 0; i < testArray.length; i++) { + testArray[i] = testling.getNextId(); + } + Arrays.sort(testArray); + for (int i = 1; i < testArray.length; i++) { + Assert.assertFalse("IdGenerator MUST return distinct ids.", testArray[i - 1] == testArray[i]); + } } } // class IdGeneratorTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 21:20:04
|
Revision: 360 http://aceunit.svn.sourceforge.net/aceunit/?rev=360&view=rev Author: christianhujer Date: 2008-10-05 21:20:00 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Added implementation for loop annotation. (Experimental!) Modified Paths: -------------- trunk/src/native/AceUnitAnnotations.h Modified: trunk/src/native/AceUnitAnnotations.h =================================================================== --- trunk/src/native/AceUnitAnnotations.h 2008-10-05 21:19:10 UTC (rev 359) +++ trunk/src/native/AceUnitAnnotations.h 2008-10-05 21:20:00 UTC (rev 360) @@ -50,6 +50,17 @@ /** Test annotation, use for test cases. */ #define A_Test ACEUNIT_ANNOTATION +/** Loop annotation, use for looping test cases. + * + * Define <code>ACEUNIT_LOOP</code> to enable this feature. + * If this feature is enabled, a test case is looped <var>times</var> times by the runner. + * The loop will only loop the test itself. + * It will not loop its <code>A_Before</code> and <code>A_After</code> methods. + * + * @param times Number of times to loop. + */ +#define A_Loop(times) ACEUNIT_ANNOTATION + /** Before annotation, use for methods that should be invoked before each test case in a fixture. */ #define A_Before ACEUNIT_ANNOTATION This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-10-05 21:19:12
|
Revision: 359 http://aceunit.svn.sourceforge.net/aceunit/?rev=359&view=rev Author: christianhujer Date: 2008-10-05 21:19:10 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Added implementation for loop annotation. (Experimental!) Modified Paths: -------------- trunk/src/native/AceUnit.c Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2008-10-05 21:15:08 UTC (rev 358) +++ trunk/src/native/AceUnit.c 2008-10-05 21:19:10 UTC (rev 359) @@ -26,6 +26,7 @@ */ /** Main module of AceUnit. + * Contains the runner. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @file AceUnit.c */ @@ -73,6 +74,10 @@ const testMethod_t *secondary; /* beforeClass, before, after, afterClass */ const testMethod_t *testCase; const TestCaseId_t *testId; +#ifdef ACEUNIT_LOOP + const aceunit_loop_t *loopMax; + aceunit_loop_t currentLoop; +#endif #ifdef ACEUNIT_LOG_FIXTURE globalLog(fixtureStarted, fixture->id); @@ -103,7 +108,13 @@ #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP if (!(setjmp(aceunitJmpBuf))) { #endif - (*testCase)(); +#ifdef ACEUNIT_LOOP + for (loopCount = 0; (loopCount < *loopMax) && (NULL == runnerdata->recenterror); loopCount++) { +#endif + (*testCase)(); +#ifdef ACEUNIT_LOOP + } +#endif #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP } #endif @@ -126,6 +137,9 @@ globalLog(testCaseEnded, runnerData->currentTestId); #endif runnerData->currentTestId = TestCaseId_NULL; +#ifdef ACEUNIT_LOOP + loopMax++; +#endif } #ifdef ACEUNIT_PRE_AFTERCLASS ACEUNIT_PRE_AFTERCLASS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |