aceunit-commit Mailing List for AceUnit (Page 13)
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-01-13 16:51:44
|
Revision: 283 http://aceunit.svn.sourceforge.net/aceunit/?rev=283&view=rev Author: christianhujer Date: 2008-01-13 08:51:05 -0800 (Sun, 13 Jan 2008) Log Message: ----------- Added missing javadoc comment. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java Modified: trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-13 16:47:22 UTC (rev 282) +++ trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-13 16:51:05 UTC (rev 283) @@ -110,6 +110,12 @@ } } + /** Implementation of {@link #read()}. + * @return read character. + * @retval -1 in case of end of file. + * @retval -2 in case this function needs to be invoked again. + * @throws IOException In caes of I/O problems. + */ private int readImpl() throws IOException { int c = super.read(); int rc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-13 16:48:55
|
Revision: 282 http://aceunit.svn.sourceforge.net/aceunit/?rev=282&view=rev Author: christianhujer Date: 2008-01-13 08:47:22 -0800 (Sun, 13 Jan 2008) Log Message: ----------- Got rid of recursive read() invocation. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java Modified: trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-12 13:50:36 UTC (rev 281) +++ trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-13 16:47:22 UTC (rev 282) @@ -92,22 +92,32 @@ /** {@inheritDoc} */ public int read() throws IOException { - if (cachedChar != null) { - try { - return cachedChar; - } finally { - if (cachedChar != -1) { - cachedChar = null; + synchronized (this) { + final Integer cachedChar = this.cachedChar; + if (cachedChar != null) { + try { + return cachedChar; + } finally { + if (cachedChar != -1) { + this.cachedChar = null; + } } } + int rc; + //noinspection StatementWithEmptyBody + while ((rc = readImpl()) == -2); + return rc; } + } + + private int readImpl() throws IOException { int c = super.read(); int rc; switch (state) { case NORMAL: if (c == '/') { state = State.SLASH; - rc = read(); + rc = -2; } else if (c == '\\') { state = State.ESCAPE; rc = c; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-12 13:50:40
|
Revision: 281 http://aceunit.svn.sourceforge.net/aceunit/?rev=281&view=rev Author: christianhujer Date: 2008-01-12 05:50:36 -0800 (Sat, 12 Jan 2008) Log Message: ----------- Made source more orthogonal. This is a preparation for a refactoring. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java Modified: trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-12 13:29:44 UTC (rev 280) +++ trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-12 13:50:36 UTC (rev 281) @@ -31,6 +31,7 @@ import java.io.Reader; import java.io.IOException; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** A NoCommentReader is a reader which replaces comments (C++, C99, Java) with whitespace. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> @@ -50,10 +51,10 @@ EOL_COMMENT, /** An asterisk after a slash was found, we are in a multiline comment now. */ - MULTILINE_COMMENT, + ML_COMMENT, /** An asterisk was found inside a multiline comment, we might have an end of the multiline comment. */ - MAYBE_END_OF_MULTILINE_COMMENT, + MAYBE_END_OF_ML_COMMENT, /** A backslash was found, we are in escape mode. */ ESCAPE, @@ -69,7 +70,7 @@ /** A backslash was found inside a string literal, the next char will NOT end it even if it is a double quote. */ ESCAPE_IN_STRING - } + } // enum State /** The internal parser state, we begin with State.NORMAL. */ private State state = State.NORMAL; @@ -85,7 +86,7 @@ * @param in a Reader protected providing the underlying stream. * @throws NullPointerException if <code>in</code> is <code>null</code> */ - public CommentToWhitespaceReader(final Reader in) { + public CommentToWhitespaceReader(@NotNull final Reader in) { super(in); } @@ -127,7 +128,7 @@ cachedChar = (int) ' '; rc = ' '; } else if (c == '*') { - state = State.MULTILINE_COMMENT; + state = State.ML_COMMENT; cachedChar = (int) ' '; rc = ' '; } else { @@ -137,38 +138,47 @@ } break; case EOL_COMMENT: - if (c == '\n' || c == '\r') { + if (c == '\n') { state = State.NORMAL; rc = c; + } else if (c == '\r') { + state = State.NORMAL; + rc = c; } else { state = State.EOL_COMMENT; rc = ' '; } break; - case MULTILINE_COMMENT: - if (c == '\n' || c == '\r') { - state = State.MULTILINE_COMMENT; + case ML_COMMENT: + if (c == '\n') { + state = State.ML_COMMENT; rc = c; + } else if (c == '\r') { + state = State.ML_COMMENT; + rc = c; } else if (c == '*') { - state = State.MAYBE_END_OF_MULTILINE_COMMENT; + state = State.MAYBE_END_OF_ML_COMMENT; rc = ' '; } else { - state = State.MULTILINE_COMMENT; + state = State.ML_COMMENT; rc = ' '; } break; - case MAYBE_END_OF_MULTILINE_COMMENT: - if (c == '\n' || c == '\r') { - state = State.MULTILINE_COMMENT; + case MAYBE_END_OF_ML_COMMENT: + if (c == '\n') { + state = State.ML_COMMENT; rc = c; + } else if (c == '\r') { + state = State.ML_COMMENT; + rc = c; } else if (c == '*') { - state = State.MAYBE_END_OF_MULTILINE_COMMENT; + state = State.MAYBE_END_OF_ML_COMMENT; rc = ' '; } else if (c == '/') { state = State.NORMAL; rc = ' '; } else { - state = State.MULTILINE_COMMENT; + state = State.ML_COMMENT; rc = ' '; } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-12 13:29:39
|
Revision: 280 http://aceunit.svn.sourceforge.net/aceunit/?rev=280&view=rev Author: christianhujer Date: 2008-01-12 05:29:44 -0800 (Sat, 12 Jan 2008) Log Message: ----------- Made source more orthogonal. This is a preparation for a refactoring. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java Modified: trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-12 13:05:27 UTC (rev 279) +++ trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-12 13:29:44 UTC (rev 280) @@ -101,88 +101,117 @@ } } int c = super.read(); + int rc; switch (state) { case NORMAL: if (c == '/') { state = State.SLASH; - return read(); + rc = read(); } else if (c == '\\') { state = State.ESCAPE; + rc = c; } else if (c == '"') { state = State.STRING; + rc = c; } else if (c == '\'') { state = State.CHAR; + rc = c; } else { state = State.NORMAL; + rc = c; } - return c; + break; case SLASH: if (c == '/') { state = State.EOL_COMMENT; cachedChar = (int) ' '; - return ' '; + rc = ' '; } else if (c == '*') { state = State.MULTILINE_COMMENT; cachedChar = (int) ' '; - return ' '; + rc = ' '; } else { state = State.NORMAL; cachedChar = c; - return '/'; + rc = '/'; } + break; case EOL_COMMENT: if (c == '\n' || c == '\r') { state = State.NORMAL; - return c; + rc = c; } else { - return ' '; + state = State.EOL_COMMENT; + rc = ' '; } + break; case MULTILINE_COMMENT: if (c == '\n' || c == '\r') { - return c; + state = State.MULTILINE_COMMENT; + rc = c; } else if (c == '*') { state = State.MAYBE_END_OF_MULTILINE_COMMENT; - return ' '; + rc = ' '; } else { - return ' '; + state = State.MULTILINE_COMMENT; + rc = ' '; } + break; case MAYBE_END_OF_MULTILINE_COMMENT: if (c == '\n' || c == '\r') { - return c; - } - if (c == '*') { - // intentionally empty + state = State.MULTILINE_COMMENT; + rc = c; + } else if (c == '*') { + state = State.MAYBE_END_OF_MULTILINE_COMMENT; + rc = ' '; } else if (c == '/') { state = State.NORMAL; + rc = ' '; } else { state = State.MULTILINE_COMMENT; + rc = ' '; } - return ' '; + break; case ESCAPE: state = State.NORMAL; - return c; + rc = c; + break; case CHAR: if (c == '\'') { state = State.NORMAL; + rc = c; } else if (c == '\\') { state = State.ESCAPE_IN_CHAR; + rc = c; + } else { + state = State.CHAR; + rc = c; } - return c; + break; case ESCAPE_IN_CHAR: state = State.CHAR; - return c; + rc = c; + break; case STRING: if (c == '"') { state = State.NORMAL; + rc = c; } else if (c == '\\') { state = State.ESCAPE_IN_STRING; + rc = c; + } else { + state = State.STRING; + rc = c; } - return c; + break; case ESCAPE_IN_STRING: state = State.STRING; - return c; + rc = c; + break; + default: + throw new AssertionError("Missing case in above switch."); } - throw new AssertionError("Missing case in above switch."); + return rc; } /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-12 13:05:33
|
Revision: 279 http://aceunit.svn.sourceforge.net/aceunit/?rev=279&view=rev Author: christianhujer Date: 2008-01-12 05:05:27 -0800 (Sat, 12 Jan 2008) Log Message: ----------- Added more test cases for CommentToWhitespaceReader. Fixed a bug in CommentToWhitespaceReader that was found with the new test cases. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java Modified: trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-12 12:59:00 UTC (rev 278) +++ trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-12 13:05:27 UTC (rev 279) @@ -126,7 +126,7 @@ cachedChar = (int) ' '; return ' '; } else { - state = State.SLASH; + state = State.NORMAL; cachedChar = c; return '/'; } Modified: trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java =================================================================== --- trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java 2008-01-12 12:59:00 UTC (rev 278) +++ trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java 2008-01-12 13:05:27 UTC (rev 279) @@ -84,7 +84,23 @@ /** 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 slashAtEnd() throws IOException { + @Test public void slashAtEndOfLine() throws IOException { + final String orig = "someCode(); /\nfoo();\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 { + final String orig = "someCode(); /\n/ foo();\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). + */ + @Test public void slashAtEndOfFile() throws IOException { final String orig = "someCode(); /"; assertReplacement(orig, orig); } @@ -92,12 +108,21 @@ /** 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 commentAtStart() throws IOException { + @Test public void eolCommentAtStart() 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); } + /** Test 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 { + final String orig = "// foo\n// bar\n// bazz\nextern void foo();\n"; + final String expe = " \n \n \nextern void foo();\n"; + 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-01-12 12:59:12
|
Revision: 278 http://aceunit.svn.sourceforge.net/aceunit/?rev=278&view=rev Author: christianhujer Date: 2008-01-12 04:59:00 -0800 (Sat, 12 Jan 2008) Log Message: ----------- Added missing test case documentation. 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-01-12 11:50:57 UTC (rev 277) +++ trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java 2008-01-12 12:59:00 UTC (rev 278) @@ -29,6 +29,7 @@ import org.junit.Test; import org.junit.Assert; +import org.jetbrains.annotations.NotNull; import java.io.StringReader; import java.io.IOException; import net.sf.aceunit.CommentToWhitespaceReader; @@ -46,7 +47,7 @@ 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 { @@ -55,7 +56,7 @@ 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 { @@ -64,7 +65,7 @@ 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 { @@ -72,7 +73,7 @@ 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 { @@ -80,7 +81,7 @@ 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 slashAtEnd() throws IOException { @@ -88,6 +89,9 @@ assertReplacement(orig, orig); } + /** 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 commentAtStart() 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"; @@ -99,7 +103,7 @@ * @param expe Expected String, will be compared to the result of passing <var>orig</var> through a {@link CommentToWhitespaceReader}. * @throws IOException In case of I/O problems (unexpected). */ - public void assertReplacement(final String orig, final String expe) throws IOException { + public void assertReplacement(@NotNull final String orig, @NotNull final String expe) throws IOException { assertReplacementSingle(orig, expe); assertReplacementBlock(orig, expe); } @@ -109,7 +113,7 @@ * @param expe Expected String, will be compared to the result of passing <var>orig</var> through a {@link CommentToWhitespaceReader}. * @throws IOException In case of I/O problems (unexpected). */ - public void assertReplacementSingle(final String orig, final String expe) throws IOException { + public void assertReplacementSingle(@NotNull final String orig, @NotNull final String expe) throws IOException { final StringReader origReader = new StringReader(orig); final CommentToWhitespaceReader reader = new CommentToWhitespaceReader(origReader); final StringBuilder sb = new StringBuilder(); @@ -123,7 +127,7 @@ * @param expe Expected String, will be compared to the result of passing <var>orig</var> through a {@link CommentToWhitespaceReader}. * @throws IOException In case of I/O problems (unexpected). */ - public void assertReplacementBlock(final String orig, final String expe) throws IOException { + public void assertReplacementBlock(@NotNull final String orig, @NotNull final String expe) throws IOException { final StringReader origReader = new StringReader(orig); final CommentToWhitespaceReader reader = new CommentToWhitespaceReader(origReader); final StringBuilder sb = new StringBuilder(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-12 11:50:56
|
Revision: 277 http://aceunit.svn.sourceforge.net/aceunit/?rev=277&view=rev Author: christianhujer Date: 2008-01-12 03:50:57 -0800 (Sat, 12 Jan 2008) Log Message: ----------- Added UnitTest for Suite. Added Paths: ----------- trunk/src/java/src/tst/test/net/sf/aceunit/SuiteTest.java Added: trunk/src/java/src/tst/test/net/sf/aceunit/SuiteTest.java =================================================================== --- trunk/src/java/src/tst/test/net/sf/aceunit/SuiteTest.java (rev 0) +++ trunk/src/java/src/tst/test/net/sf/aceunit/SuiteTest.java 2008-01-12 11:50:57 UTC (rev 277) @@ -0,0 +1,18 @@ +package test.net.sf.aceunit; + +import net.sf.aceunit.Suite; +import org.junit.Test; +import org.junit.Assert; + +/** Unit Test for {@link Suite}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class SuiteTest { + + /** Tests that a Suite stores its id when created. */ + @Test public void testId() { + final Suite suite = new Suite(10); + Assert.assertEquals("Id must be stored.", 10, suite.getId()); + } + +} // class SuiteTest Property changes on: trunk/src/java/src/tst/test/net/sf/aceunit/SuiteTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: 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-01-12 11:47:44
|
Revision: 276 http://aceunit.svn.sourceforge.net/aceunit/?rev=276&view=rev Author: christianhujer Date: 2008-01-12 03:47:45 -0800 (Sat, 12 Jan 2008) Log Message: ----------- Fixed javadoc comment. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java trunk/src/java/src/prj/net/sf/aceunit/Suite.java Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2008-01-07 00:46:21 UTC (rev 275) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2008-01-12 11:47:45 UTC (rev 276) @@ -149,7 +149,7 @@ /** Writes a String to a file if the String differs from the file's content. * @param file File to write to. * @param text String to write to the file. - * @throws IOException + * @throws IOException In case of I/O problems. */ void writeIfChanged(@NotNull final File file, @NotNull final String text) throws IOException { if (!file.exists() || !text.equals(readSource(file))) { Modified: trunk/src/java/src/prj/net/sf/aceunit/Suite.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Suite.java 2008-01-07 00:46:21 UTC (rev 275) +++ trunk/src/java/src/prj/net/sf/aceunit/Suite.java 2008-01-12 11:47:45 UTC (rev 276) @@ -63,6 +63,7 @@ * @return <code>true</code> if Suites were found, otherwise <code>false</code>. */ public boolean findSuites(@NotNull final File file) { + // TODO return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-07 00:46:16
|
Revision: 275 http://aceunit.svn.sourceforge.net/aceunit/?rev=275&view=rev Author: christianhujer Date: 2008-01-06 16:46:21 -0800 (Sun, 06 Jan 2008) Log Message: ----------- Updated documentation about future versions. Modified Paths: -------------- trunk/src/doc/future.xhtml Modified: trunk/src/doc/future.xhtml =================================================================== --- trunk/src/doc/future.xhtml 2008-01-07 00:41:24 UTC (rev 274) +++ trunk/src/doc/future.xhtml 2008-01-07 00:46:21 UTC (rev 275) @@ -12,25 +12,19 @@ <p> The following features are planned for future versions: </p> - <h2>AceUnit 0.3</h2> <ul> - <li>Pluggable test runners</li> - <li>Pluggable logger system</li> - </ul> - <h2>Future Versions</h2> - <ul> - <li>Create JUnit compatible loggers</li> - <li>Optional automatic generation of main() function</li> + <li>Optional feature: Pluggable test runners</li> + <li>Optional feature: Create / finnish implementation of JUnit compatible loggers</li> + <li>Optional feature: Randomization of test order</li> + <li>Optional feature: Automatic generation of main() function</li> + <li>Optional feature: Recursive suites</li> <li>Better logging of information, e.g. expected and actual values</li> <li>Alternative test runner with more information, e.g. timing values</li> - <li>Recursive collection of test fixtures</li> - <li>Implement the full set of assertion methods found in org.junit.Assert</li> <li> - Add options to runner: + Optional feature: options to runner <ul> <li>Runtime configuration of loggers</li> - <li>Runtime configuration of fixtures</li> - <li>Runtime configuration of test cases</li> + <li>Runtime configuration of suites, fixtures and test cases to execute.</li> </ul> </li> </ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-07 00:41:19
|
Revision: 274 http://aceunit.svn.sourceforge.net/aceunit/?rev=274&view=rev Author: christianhujer Date: 2008-01-06 16:41:24 -0800 (Sun, 06 Jan 2008) Log Message: ----------- Commit of work in progress: Support for user-defined pre- and post-method code. (done) Support for recursive suites. (in progress) Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java trunk/src/native/AceUnit.c trunk/src/native/AceUnit.h Added Paths: ----------- trunk/src/java/src/prj/net/sf/aceunit/Suite.java Modified: trunk/src/java/src/prj/net/sf/aceunit/Fixture.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-01-07 00:08:35 UTC (rev 273) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-01-07 00:41:24 UTC (rev 274) @@ -36,7 +36,7 @@ /** The Fixture represents a single test fixture along with all its methods. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class Fixture { +public class Fixture extends Suite { /** The list of {@code @Test} methods. */ private final MethodList testMethods = MethodList.createTestMethodList(); @@ -62,14 +62,11 @@ /** All method lists for used methods for easy iteration. */ private final List<MethodList> usedMethodLists = Arrays.asList(testMethods, beforeMethods, afterMethods, beforeClassMethods, afterClassMethods); - /** The id of this fixture. */ - private final int id; - /** Creatse a Fixture with the specified id. - * @param id Id of the fixture + * @param id The id of this Fixture. */ public Fixture(final int id) { - this.id = id; + super(id); } /** Creates Fixture with a default id of 1. */ @@ -123,7 +120,7 @@ out.format("#ifndef A_FIXTURE_ID%n"); out.format("/** The id of this fixture. */%n"); out.format("#ifdef ACEUNIT_EMBEDDED%n"); - out.format("#define A_FIXTURE_ID %d%n", id); + out.format("#define A_FIXTURE_ID %d%n", getId()); out.format("#else%n"); out.format("#define A_FIXTURE_ID \"%s\"%n", basename); out.format("#endif%n"); @@ -156,6 +153,9 @@ out.format("/** This fixture. */%n"); out.format("const TestFixture_t %sFixture = {%n", basename); out.format(" A_FIXTURE_ID,%n"); + out.format("#ifdef ACEUNIT_SUITES%n"); + out.format(" NULL,%n"); + out.format("#endif%n"); out.format(" testId,%n"); out.format(" testCases,%n"); out.format(" before,%n"); @@ -187,7 +187,7 @@ final Formatter out = new Formatter(); out.format("/** The test case ids of this fixture. */%n"); out.format("static const TestCaseId_t testId[] = {%n"); - out.format("#if defined(ACEUNIT_EMBEDDED)%n"); + out.format("#ifdef ACEUNIT_EMBEDDED%n"); int methodCount = 0; final String formatString = String.format(" %%%dd, /* %%s */%%n", (int) (Math.log10(testMethods.size()) + 1)); for (final String method : testMethods) { Added: trunk/src/java/src/prj/net/sf/aceunit/Suite.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/Suite.java (rev 0) +++ trunk/src/java/src/prj/net/sf/aceunit/Suite.java 2008-01-07 00:41:24 UTC (rev 274) @@ -0,0 +1,98 @@ +/* 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 org.jetbrains.annotations.NotNull; +import java.io.File; +import java.util.Formatter; +import java.util.ArrayList; +import java.util.List; + +/** The Suite represents a Suite with all its Suites. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class Suite { + + /** The id of this Suite. */ + private final int id; + + /** The list of suites found. */ + @NotNull private final List<Suite> suites = new ArrayList<Suite>(); + + /** Creates a Suite with the specified id. + * @param id The id for this Suite. + */ + public Suite(final int id) { + this.id = id; + } + + /** Returns the id of this Suite. + * @return The id of this Suite. + */ + public int getId() { + return id; + } + + /** Finds all Suites in the specified file or directory. + * @param file File to search. + * @return <code>true</code> if Suites were found, otherwise <code>false</code>. + */ + public boolean findSuites(@NotNull final File file) { + return false; + } + + /** Returns a String representing the C-Source code for this Suite. + * @param basename Base name of this Suite. + * @return String with the C-Source for this Suite. + */ + public String getSuiteCode(@NotNull final String basename) { + final Formatter out = new Formatter(); + out.format("/** AceUnit test header file for suite %s.%n", basename); + out.format(" *%n"); + out.format(" * @warning This is a generated file. Do not edit. Your changes will be lost.%n"); + out.format(" * @file %s.h%n", basename); + out.format(" */%n"); + out.format("%n"); + out.format("const TestSuite_t *suites = {%n"); + for (final Suite suite : suites) { + out.format(" suite%d,%n", suite.getId()); + } + out.format("};%n"); + out.format("%n"); + out.format("const TestSuite_t suite%d = {%n", getId()); + out.format("#ifdef ACEUNIT_EMBEDDED%n"); + out.format(" %d,%n", getId()); + out.format("#else%n"); + out.format(" \"%s\",%n", basename); + out.format("#endif%n"); + out.format(" suites%n"); + out.format("};%n"); + return out.toString(); + } + +} // class Suite Property changes on: trunk/src/java/src/prj/net/sf/aceunit/Suite.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2008-01-07 00:08:35 UTC (rev 273) +++ trunk/src/native/AceUnit.c 2008-01-07 00:41:24 UTC (rev 274) @@ -74,20 +74,32 @@ const testMethod_t *testCase; const TestCaseId_t *testId; -#ifdef ACEUNIT_LOG_SUITE - globalLog(suiteStarted, NULL); -#endif #ifdef ACEUNIT_LOG_FIXTURE globalLog(fixtureStarted, fixture->id); #endif +#ifdef ACEUNIT_PRE_BEFORECLASS + ACEUNIT_PRE_BEFORECLASS(); +#endif invokeAll(beforeClass); +#ifdef ACEUNIT_POST_BEFORECLASS + ACEUNIT_POST_BEFORECLASS(); +#endif for (testCase = fixture->testCase, testId = fixture->testId; NULL != *testCase; testCase++, testId++) { runnerData->currentTestId = *testId; #ifdef ACEUNIT_LOG_TESTCASE globalLog(testCaseStarted, runnerData->currentTestId); #endif +#ifdef ACEUNIT_PRE_BEFORE + ACEUNIT_PRE_BEFORE(); +#endif invokeAll(before); +#ifdef ACEUNIT_POST_BEFORE + ACEUNIT_POST_BEFORE(); +#endif runnerData->recentError = NULL; +#ifdef ACEUNIT_PRE_TEST + ACEUNIT_PRE_TEST(); +#endif #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP if (!(setjmp(aceunitJmpBuf))) { #endif @@ -95,24 +107,36 @@ #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP } #endif +#ifdef ACEUNIT_POST_TEST + ACEUNIT_POST_TEST(); +#endif runnerData->testCaseCount++; if (NULL != runnerData->recentError) { globalLog(testCaseFailed, runnerData->recentError); runnerData->testCaseFailureCount++; } +#ifdef ACEUNIT_PRE_AFTER + ACEUNIT_PRE_AFTER(); +#endif invokeAll(after); +#ifdef ACEUNIT_POST_AFTER + ACEUNIT_POST_AFTER(); +#endif #ifdef ACEUNIT_LOG_TESTCASE globalLog(testCaseEnded, runnerData->currentTestId); #endif runnerData->currentTestId = TestCaseId_NULL; } +#ifdef ACEUNIT_PRE_AFTERCLASS + ACEUNIT_PRE_AFTERCLASS(); +#endif invokeAll(afterClass); +#ifdef ACEUNIT_POST_AFTERCLASS + ACEUNIT_POST_AFTERCLASS(); +#endif #ifdef ACEUNIT_LOG_FIXTURE globalLog(fixtureEnded, fixture->id); #endif -#ifdef ACEUNIT_LOG_SUITE - globalLog(suiteEnded, NULL); -#endif #undef invokeAll #undef globalLog } @@ -121,11 +145,38 @@ * @param fixtures Test fixtures to run (NULL terminated). */ void runFixtures(const TestFixture_t *const fixtures[]) { - while (*fixtures != NULL) { + while (NULL != *fixtures) { runFixture(*fixtures); fixtures++; } } +/** Runs all test cases from the supplied suite. + * @param suite Test suite to run. + */ +void runSuite(const TestSuite_t *const suite) { +#define globalLog(X, Y) if ((NULL != globalLogger) && (NULL != globalLogger->X)) {\ + globalLogger->X(Y);\ +} + + const TestSuite_t *const *suites = suite->suites; +#ifdef ACEUNIT_LOG_SUITE + globalLog(suiteStarted, suite->id); +#endif + if (suites != NULL) { + /* this is a not a Fixture */ + for (; NULL != *suites; suites++) { + runSuite(*suites); + } + } else { + /* this is a Fixture */ + runFixture((TestFixture_t *) suite); + } +#ifdef ACEUNIT_LOG_SUITE + globalLog(suiteEnded, suite->id); +#endif +#undef globalLog +} + /* 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 2008-01-07 00:08:35 UTC (rev 273) +++ trunk/src/native/AceUnit.h 2008-01-07 00:41:24 UTC (rev 274) @@ -96,6 +96,50 @@ * You will then have to initialize #runnerData yourself. * AceUnit doesn't automatically put it on the stack itself because you might want to access the results from where you invoked the runner. * </dd> + * <dt><code>ACEUNIT_SUITES</code></dt> + * <dd> + * Define this macro to use AceUnit with support for Suites. + * </dd> + * <dt><code>ACEUNIT_PRE_BEFORECLASS</code></dt> + * <dd> + * If you want AceUnit to execute code prior to every beforeclass method, define this macro with that code. + * </dd> + * <dt><code>ACEUNIT_POST_BEFORECLASS</code></dt> + * <dd> + * If you want AceUnit to execute code after every beforeclass method, define this macro with that code. + * </dd> + * <dt><code>ACEUNIT_PRE_BEFORE</code></dt> + * <dd> + * If you want AceUnit to execute code before every before method, define this macro with that code. + * </dd> + * <dt><code>ACEUNIT_POST_BEFORE</code></dt> + * <dd> + * If you want AceUnit to execute code after every before method, define this macro with that code. + * </dd> + * <dt><code>ACEUNIT_PRE_TEST</code></dt> + * <dd> + * If you want AceUnit to execute code before every test method, define this macro with that code. + * </dd> + * <dt><code>ACEUNIT_POST_TEST</code></dt> + * <dd> + * If you want AceUnit to execute code after every test method, define this macro with that code. + * </dd> + * <dt><code>ACEUNIT_PRE_AFTER</code></dt> + * <dd> + * If you want AceUnit to execute code before every after method, define this macro with that code. + * </dd> + * <dt><code>ACEUNIT_POST_AFTER</code></dt> + * <dd> + * If you want AceUnit to execute code after every after method, define this macro with that code. + * </dd> + * <dt><code>ACEUNIT_PRE_AFTERCLASS</code></dt> + * <dd> + * If you want AceUnit to execute code before every afterclass method, define this macro with that code. + * </dd> + * <dt><code>ACEUNIT_POST_AFTERCLASS</code></dt> + * <dd> + * If you want AceUnit to execute code after every afterclass method, define this macro with that code. + * </dd> * </dl> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @file AceUnit.h @@ -236,16 +280,23 @@ #error Unexpected internal error. #endif -/** FixtureId_t specifies a test fixture. - * On embedded systems, this is a 16 bit quantity that uniquely identifies the test fixture. - * On normal systems, this is the filename of fixture. +/** SuiteId_t specifies a test suite. + * On embedded systems, this is a 16 bit quantity that uniquely identifies the test suite. + * On normal systems, this is the directory name of the suite. + * @note Fixtures also are Suites. */ #ifdef ACEUNIT_EMBEDDED -typedef uint16_t FixtureId_t; +typedef uint16_t SuiteId_t; #else -typedef const char* FixtureId_t; +typedef const char* SuiteId_t; #endif +/** FixtureId_t specifies a test fixture. + * On embedded systems, this is a 16 bit quantity that uniquely identifies the test fixture. + * On normal systems, this is the filename of fixture. + */ +typedef SuiteId_t FixtureId_t; + /** TestCaseId_t specifies a test case. * On embedded systems, this is a 16 bit quantity that uniquely identifies the test case within its fixture. * On normal systems, this is the function name of the test case. @@ -370,14 +421,38 @@ */ typedef void(*testMethod_t)(); +/** A Suite is a loose collection of test cases. + * It consists of other suites and fixtures. + */ +typedef struct TestSuite_tt { + + /** The Id of this suite. */ + SuiteId_t const id; + + /** The suites that are contained in this suite. + * If this Suite is a Fixture, this value is NULL. + */ + const struct TestSuite_tt *const *const suites; + +} TestSuite_t; + /** 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> */ typedef struct { + /* Implementation note: Take care that the beginning of TestFixture_t is identical to that of TestSuite_t! */ + /** The Id of this fixture. */ FixtureId_t const id; +#ifdef ACEUNIT_SUITES + /** The suites that are contained in this fixture. + * This is a fixture, thus this value always is NULL. + */ + const TestSuite_t *const *const suites; +#endif + /** The ids of the test cases of this test fixture. */ const TestCaseId_t *const testId; @@ -409,4 +484,9 @@ */ extern void runFixture(const TestFixture_t *const fixture); +/** Runs all test cases from a test suite. + * @param suite Test suite to run. + */ +extern void runSuite(const TestSuite_t *const suite); + #endif /* ACEUNIT_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-07 00:08:30
|
Revision: 273 http://aceunit.svn.sourceforge.net/aceunit/?rev=273&view=rev Author: christianhujer Date: 2008-01-06 16:08:35 -0800 (Sun, 06 Jan 2008) Log Message: ----------- Extracted method writeIfChanged(). 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 2008-01-06 20:32:34 UTC (rev 272) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2008-01-07 00:08:35 UTC (rev 273) @@ -146,6 +146,25 @@ return containedFixture; } + /** Writes a String to a file if the String differs from the file's content. + * @param file File to write to. + * @param text String to write to the file. + * @throws IOException + */ + void writeIfChanged(@NotNull final File file, @NotNull final String text) throws IOException { + if (!file.exists() || !text.equals(readSource(file))) { + if (force) { + file.setWritable(true); + } + final PrintWriter out = new PrintWriter(new FileWriter(file)); + try { + out.append(text); + } finally { + out.close(); + } + } + } + /** 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. @@ -160,14 +179,7 @@ if (containedFixture) { final File hFile = new File(fixtureFile.getParent(), fixtureName + ".h"); final String hSource = fixture.getFixtureCode(fixtureName); - if (!hFile.exists() || !hSource.equals(readSource(hFile))) { - if (force) { - hFile.setWritable(true); - } - final PrintWriter out = new PrintWriter(new FileWriter(hFile)); - out.append(hSource); - out.close(); - } + writeIfChanged(hFile, hSource); } return containedFixture; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-06 20:32:29
|
Revision: 272 http://aceunit.svn.sourceforge.net/aceunit/?rev=272&view=rev Author: christianhujer Date: 2008-01-06 12:32:34 -0800 (Sun, 06 Jan 2008) Log Message: ----------- Added German translation of help texts. Added Paths: ----------- trunk/src/java/src/prj/net/sf/aceunit/GenTest_de.properties Added: trunk/src/java/src/prj/net/sf/aceunit/GenTest_de.properties =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest_de.properties (rev 0) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest_de.properties 2008-01-06 20:32:34 UTC (rev 272) @@ -0,0 +1,29 @@ +# 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. + +helpHeader=Verwendung: java -jar AceUnit.jar [OPTION]... [BASENAME]...\nErzeuge AceUnit Unit Test Header-Dateien f\xFCr ein oder mehrere Test-Suiten mit den angegebenen BASENAME(s) (.c-Suffix bei Fixtures weglassen).\n +helpFooter=Beispiele:\n java -jar AceUnit.jar sortTest\n +setForce=Schreibgesch\xFCtzte Dateien \xFCberschreiben. Property changes on: trunk/src/java/src/prj/net/sf/aceunit/GenTest_de.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: 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-01-06 20:32:22
|
Revision: 271 http://aceunit.svn.sourceforge.net/aceunit/?rev=271&view=rev Author: christianhujer Date: 2008-01-06 12:32:18 -0800 (Sun, 06 Jan 2008) Log Message: ----------- Improved help text. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties 2008-01-06 17:00:23 UTC (rev 270) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties 2008-01-06 20:32:18 UTC (rev 271) @@ -24,7 +24,6 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -helpHeader=Usage: java -jar AceUnit.jar [OPTION] [BASENAME]...\nCreate AceUnit unit test headers for one or more modules with the specified basename (omit .c suffix).\n +helpHeader=Usage: java -jar AceUnit.jar [OPTION]... [BASENAME]...\nCreate AceUnit unit test headers for one or more suites with the specified BASENAME(s) (omit .c suffix for fixtures).\n helpFooter=Examples:\n java -jar AceUnit.jar sortTest\n setForce=Overwrite write-protected files. -setNoForce=Do not overwrite write-protected files. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-06 17:00:25
|
Revision: 270 http://aceunit.svn.sourceforge.net/aceunit/?rev=270&view=rev Author: christianhujer Date: 2008-01-06 09:00:23 -0800 (Sun, 06 Jan 2008) Log Message: ----------- Added comment to global test suite. Modified Paths: -------------- trunk/src/native/test/Makefile Modified: trunk/src/native/test/Makefile =================================================================== --- trunk/src/native/test/Makefile 2008-01-06 16:56:37 UTC (rev 269) +++ trunk/src/native/test/Makefile 2008-01-06 17:00:23 UTC (rev 270) @@ -1,4 +1,4 @@ -DIRS=basic basicEmbedded exhand longjmp xmlLog twoFixtures recursive +DIRS=basic basicEmbedded comment exhand longjmp xmlLog twoFixtures recursive all: @for dir in $(DIRS) ; do (cd $$dir ; make) ; done This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-06 16:56:53
|
Revision: 269 http://aceunit.svn.sourceforge.net/aceunit/?rev=269&view=rev Author: christianhujer Date: 2008-01-06 08:56:37 -0800 (Sun, 06 Jan 2008) Log Message: ----------- [ 1864061 ] Java Generator does not recognize comments -> linker problem Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java Added Paths: ----------- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java trunk/src/native/test/comment/ trunk/src/native/test/comment/CommentTest.c trunk/src/native/test/comment/Makefile Added: trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java (rev 0) +++ trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java 2008-01-06 16:56:37 UTC (rev 269) @@ -0,0 +1,205 @@ +/* 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.io.FilterReader; +import java.io.Reader; +import java.io.IOException; +import org.jetbrains.annotations.Nullable; + +/** A NoCommentReader is a reader which replaces comments (C++, C99, Java) with whitespace. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class CommentToWhitespaceReader extends FilterReader { + + /** The internal states of the parser. */ + enum State { + + /** Nothing special, normal source. */ + NORMAL, + + /** A slash was found, we might have a comment. */ + SLASH, + + /** A second slash was found, we are in an EOL comment now. */ + EOL_COMMENT, + + /** An asterisk after a slash was found, we are in a multiline comment now. */ + MULTILINE_COMMENT, + + /** An asterisk was found inside a multiline comment, we might have an end of the multiline comment. */ + MAYBE_END_OF_MULTILINE_COMMENT, + + /** A backslash was found, we are in escape mode. */ + ESCAPE, + + /** An apostroph was found, we are inside a char literal. */ + CHAR, + + /** A backslash was found inside a char literal, the next char will NOT end it even if it is an apostroph. */ + ESCAPE_IN_CHAR, + + /** A double quote was found, we are inside a string literal. */ + STRING, + + /** A backslash was found inside a string literal, the next char will NOT end it even if it is a double quote. */ + ESCAPE_IN_STRING + } + + /** The internal parser state, we begin with State.NORMAL. */ + private State state = State.NORMAL; + + /** The cached character is used to return a char that can only be returned when its following char was konwn. + * If this is <code>null</code>, there is no cached character. + */ + @Nullable + private Integer cachedChar; + + /** Creates a new NoCommentReader. + * + * @param in a Reader protected providing the underlying stream. + * @throws NullPointerException if <code>in</code> is <code>null</code> + */ + public CommentToWhitespaceReader(final Reader in) { + super(in); + } + + /** {@inheritDoc} */ + public int read() throws IOException { + if (cachedChar != null) { + try { + return cachedChar; + } finally { + if (cachedChar != -1) { + cachedChar = null; + } + } + } + int c = super.read(); + switch (state) { + case NORMAL: + if (c == '/') { + state = State.SLASH; + return read(); + } else if (c == '\\') { + state = State.ESCAPE; + } else if (c == '"') { + state = State.STRING; + } else if (c == '\'') { + state = State.CHAR; + } else { + state = State.NORMAL; + } + return c; + case SLASH: + if (c == '/') { + state = State.EOL_COMMENT; + cachedChar = (int) ' '; + return ' '; + } else if (c == '*') { + state = State.MULTILINE_COMMENT; + cachedChar = (int) ' '; + return ' '; + } else { + state = State.SLASH; + cachedChar = c; + return '/'; + } + case EOL_COMMENT: + if (c == '\n' || c == '\r') { + state = State.NORMAL; + return c; + } else { + return ' '; + } + case MULTILINE_COMMENT: + if (c == '\n' || c == '\r') { + return c; + } else if (c == '*') { + state = State.MAYBE_END_OF_MULTILINE_COMMENT; + return ' '; + } else { + return ' '; + } + case MAYBE_END_OF_MULTILINE_COMMENT: + if (c == '\n' || c == '\r') { + return c; + } + if (c == '*') { + // intentionally empty + } else if (c == '/') { + state = State.NORMAL; + } else { + state = State.MULTILINE_COMMENT; + } + return ' '; + case ESCAPE: + state = State.NORMAL; + return c; + case CHAR: + if (c == '\'') { + state = State.NORMAL; + } else if (c == '\\') { + state = State.ESCAPE_IN_CHAR; + } + return c; + case ESCAPE_IN_CHAR: + state = State.CHAR; + return c; + case STRING: + if (c == '"') { + state = State.NORMAL; + } else if (c == '\\') { + state = State.ESCAPE_IN_STRING; + } + return c; + case ESCAPE_IN_STRING: + state = State.STRING; + return c; + } + throw new AssertionError("Missing case in above switch."); + } + + /** {@inheritDoc} */ + public int read(final char[] cbuf, final int off, final int len) throws IOException { + int i; + for (i = 0; i < len; i++) { + int c = read(); + if (c == -1) { + if (i == 0) { + return -1; + } else { + break; + } + } + cbuf[off + i] = (char) c; + } + return i; + } + +} // class CommentToWhitespaceReader Property changes on: trunk/src/java/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2008-01-06 16:12:45 UTC (rev 268) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2008-01-06 16:56:37 UTC (rev 269) @@ -33,6 +33,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import java.io.Reader; import java.util.List; import net.sf.japi.io.args.ArgParser; import net.sf.japi.io.args.BasicCommand; @@ -153,7 +154,7 @@ */ 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 String cSource = readSourceWithoutComments(fixtureFile); final Fixture fixture = new Fixture(); final boolean containedFixture = fixture.findMethods(cSource); if (containedFixture) { @@ -177,7 +178,7 @@ * @throws IOException in case of I/O problems. */ private String readSource(@NotNull final File file) throws IOException { - final FileReader in = new FileReader(file); + final Reader in = new FileReader(file); final StringBuilder sb = new StringBuilder(); final char[] buf = new char[4096]; for (int charsRead; (charsRead = in.read(buf)) != -1;) { @@ -187,6 +188,22 @@ return sb.toString(); } + /** Reads a source file without comments. + * @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 readSourceWithoutComments(@NotNull final File file) throws IOException { + final Reader in = new CommentToWhitespaceReader(new FileReader(file)); + final StringBuilder sb = new StringBuilder(); + final char[] buf = new char[4096]; + for (int charsRead; (charsRead = in.read(buf)) != -1;) { + sb.append(buf, 0, charsRead); + } + in.close(); + return sb.toString(); + } + /** {@inheritDoc} */ public int run(@NotNull final List<String> args) throws Exception { if (args.size() == 0) { Added: trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java =================================================================== --- trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java (rev 0) +++ trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java 2008-01-06 16:56:37 UTC (rev 269) @@ -0,0 +1,136 @@ +/* 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 test.net.sf.aceunit; + +import org.junit.Test; +import org.junit.Assert; +import java.io.StringReader; +import java.io.IOException; +import net.sf.aceunit.CommentToWhitespaceReader; + +/** Tests that NoCommentReader replaces comments with whitespace. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class CommentToWhitespaceReaderTest { + + /** 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 { + final String orig = "void foo() {\n bar();\n}\n"; + assertReplacement(orig, orig); + } + + /** + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void eolComments() 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); + } + + /** + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void multilineComments() 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); + } + + /** + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void pseudoEolCommentInString() throws IOException { + final String orig = "void foo() {\n printf(\"// pseudocomment\");\n}\n"; + assertReplacement(orig, orig); + } + + /** + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void pseudoMultilineCommentInString() throws IOException { + final String orig = "void foo() {\n printf(\"/* pseudocomment */\");\n}\n"; + assertReplacement(orig, orig); + } + + /** + * @throws IOException In case of I/O problems (unexpected). + */ + @Test public void slashAtEnd() throws IOException { + final String orig = "someCode(); /"; + assertReplacement(orig, orig); + } + + @Test public void commentAtStart() 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); + } + + /** 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}. + * @throws IOException In case of I/O problems (unexpected). + */ + public void assertReplacement(final String orig, final String expe) throws IOException { + assertReplacementSingle(orig, expe); + assertReplacementBlock(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}. + * @throws IOException In case of I/O problems (unexpected). + */ + public void assertReplacementSingle(final String orig, final String expe) throws IOException { + final StringReader origReader = new StringReader(orig); + final CommentToWhitespaceReader reader = new CommentToWhitespaceReader(origReader); + final StringBuilder sb = new StringBuilder(); + //noinspection StatementWithEmptyBody + for (int c; (c = reader.read()) != -1; sb.append((char) c)); + Assert.assertEquals(expe, sb.toString()); + } + + /** 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}. + * @throws IOException In case of I/O problems (unexpected). + */ + public void assertReplacementBlock(final String orig, final String expe) throws IOException { + final StringReader origReader = new StringReader(orig); + final CommentToWhitespaceReader reader = new CommentToWhitespaceReader(origReader); + final StringBuilder sb = new StringBuilder(); + final char[] buf = new char[4096]; + //noinspection StatementWithEmptyBody + for (int charsRead; (charsRead = reader.read(buf)) != -1; sb.append(buf, 0, charsRead)); + Assert.assertEquals(expe, sb.toString()); + } + +} // class CommentToWhitespaceReaderTest Property changes on: trunk/src/java/src/tst/test/net/sf/aceunit/CommentToWhitespaceReaderTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/native/test/comment/CommentTest.c =================================================================== --- trunk/src/native/test/comment/CommentTest.c (rev 0) +++ trunk/src/native/test/comment/CommentTest.c 2008-01-06 16:56:37 UTC (rev 269) @@ -0,0 +1,76 @@ +/* Copyright (c) 2007, Christian Hujer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the AceUnit developers nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** Unit Test for AceUnit. + * Yes, AceUnit can be tested using itself. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @file AceUnitTest.c + */ + +#include <stdbool.h> +#include <stdio.h> + +#include "AceUnitData.h" +#include "CommentTest.h" + +/** An empty test that is not commented out. */ +A_Test void test1() { +} + +/** An empty test that is commented out via annotation. */ +/* A_Test */ void test2() { + fail("this is not a test."); +} + +/* An empty test that is commented out completely via multiline comment. */ +/* +A_Test void test3() { +} +*/ + +/* An empty test that is commented out completely via eol comments. */ +//A_Test void test4() { +//} + +A_Test void test5() {} + +/** 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[]) { + runFixture(&CommentTestFixture); + if (runnerData->testCaseFailureCount != 0) { + fprintf(stderr, "Test Cases: %d Errors: %d\n", runnerData->testCaseCount, runnerData->testCaseFailureCount); + return 1; + } + return 0; +} Property changes on: trunk/src/native/test/comment/CommentTest.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/src/native/test/comment/Makefile =================================================================== --- trunk/src/native/test/comment/Makefile (rev 0) +++ trunk/src/native/test/comment/Makefile 2008-01-06 16:56:37 UTC (rev 269) @@ -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=CommentTest + +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) -std=c99 -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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-06 16:12:42
|
Revision: 268 http://aceunit.svn.sourceforge.net/aceunit/?rev=268&view=rev Author: christianhujer Date: 2008-01-06 08:12:45 -0800 (Sun, 06 Jan 2008) Log Message: ----------- Added missing copyright statement. 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-01-03 00:37:06 UTC (rev 267) +++ trunk/src/java/src/prj/net/sf/aceunit/Fixture.java 2008-01-06 16:12:45 UTC (rev 268) @@ -1,3 +1,30 @@ +/* Copyright (c) 2007 - 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.Arrays; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-01-03 00:37:03
|
Revision: 267 http://aceunit.svn.sourceforge.net/aceunit/?rev=267&view=rev Author: christianhujer Date: 2008-01-02 16:37:06 -0800 (Wed, 02 Jan 2008) Log Message: ----------- [ 1862809 ] Incorrect example in --help text Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties 2007-12-23 23:29:15 UTC (rev 266) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties 2008-01-03 00:37:06 UTC (rev 267) @@ -25,6 +25,6 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. helpHeader=Usage: java -jar AceUnit.jar [OPTION] [BASENAME]...\nCreate AceUnit unit test headers for one or more modules with the specified basename (omit .c suffix).\n -helpFooter=Examples:\n java -jar AceUnit.jar sortTest >sortTest.h\n +helpFooter=Examples:\n java -jar AceUnit.jar sortTest\n setForce=Overwrite write-protected files. setNoForce=Do not overwrite write-protected files. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-12-23 23:29:10
|
Revision: 266 http://aceunit.svn.sourceforge.net/aceunit/?rev=266&view=rev Author: christianhujer Date: 2007-12-23 15:29:15 -0800 (Sun, 23 Dec 2007) Log Message: ----------- Added assertions for NULL and NOT NULL. Modified Paths: -------------- trunk/src/native/AceUnit.h Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2007-12-18 21:25:49 UTC (rev 265) +++ trunk/src/native/AceUnit.h 2007-12-23 23:29:15 UTC (rev 266) @@ -346,6 +346,20 @@ */ #define assertNotEquals(message, unexpected, actual) if ((unexpected) == (actual)) { fail(message); } /* TODO: expected vs. actual in message */ +/** Asserts that a pointer is not NULL. + * If the pointer is NULL, the test case fails and raises an {@link AssertionError_t} that will be logged. + * @param message Message, usually with the positive description of why the assertion should not fail. + * @param ptr Pointer expected to be not NULL. + */ +#define assertNotNull(message, ptr) if (NULL == (ptr)) { fail(message); } + +/** Asserts that a pointer is NULL. + * If the pointer is not NULL, the test case fails and raises an {@link AssertionError_t} that will be logged. + * @param message Message, usually with the positive description of why the assertion should not fail. + * @param ptr Pointer expected to be NULL. + */ +#define assertNull(message, ptr) if (NULL != (ptr)) { fail(message); } + /** Method signature for annotated test methods. * @see #A_Test * @see #A_Before This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-12-18 21:25:46
|
Revision: 265 http://aceunit.svn.sourceforge.net/aceunit/?rev=265&view=rev Author: christianhujer Date: 2007-12-18 13:25:49 -0800 (Tue, 18 Dec 2007) Log Message: ----------- [ 1853329 ] Reduce RAM consumption Modified Paths: -------------- trunk/src/native/AceUnit.c trunk/src/native/AceUnit.h trunk/src/native/AceUnitData.c trunk/src/native/test/basic/AceUnitTest.c trunk/src/native/test/basic/Makefile trunk/src/native/test/basicEmbedded/AceUnitTest.c trunk/src/native/test/basicEmbedded/Makefile trunk/src/native/test/longjmp/LongJmpTest.c trunk/src/native/test/longjmp/Makefile trunk/src/native/test/recursive/Makefile trunk/src/native/test/recursive/TestMain.c trunk/src/native/test/twoFixtures/Makefile trunk/src/native/test/twoFixtures/RunTest.c trunk/src/native/test/xmlLog/Makefile trunk/src/native/test/xmlLog/XmlLogTest.c Added Paths: ----------- trunk/src/native/AceUnitData.h Modified: trunk/src/native/AceUnit.c =================================================================== --- trunk/src/native/AceUnit.c 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/AceUnit.c 2007-12-18 21:25:49 UTC (rev 265) @@ -32,6 +32,7 @@ #include "AceUnit.h" #include "AceUnitLogging.h" +#include "AceUnitData.h" #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP #include <setjmp.h> @@ -41,36 +42,15 @@ #include ACEUNIT_CODE_INCLUDE #endif -/** The most recent error will be remembered here. - * This variable will be set by {@link #recordError()} and read by {@link #runFixture()}. - * It is set to NULL before each test case. - * If it is not NULL after a test case, the test case failed. - */ -extern AssertionError_t *recentError; - -/** This is the most recent error. */ -extern AssertionError_t recentErrorData; - -/** The id of the currently executed test case. - * This variable will be set by {@link #runFixture()} and read by {@link #recordError()}. - */ -extern TestCaseId_t currentTestId; - -/** The number of test cases that were executed. */ -extern uint16_t testCaseCount; - -/** The number of test cases that failed. */ -extern uint16_t testCaseFailureCount; - /** Records an error. * @param fixtureId Id of the fixture that contained the test case with the failed assertion. * @param assertionId Id of the assertion that failed. */ void recordError(const FixtureId_t fixtureId, const AssertionId_t assertionId) { - recentError = &recentErrorData; - recentError->fixtureId = fixtureId; - recentError->assertionId = assertionId; - recentError->testId = currentTestId; + runnerData->recentError = &runnerData->recentErrorData; + runnerData->recentError->fixtureId = fixtureId; + runnerData->recentError->assertionId = assertionId; + runnerData->recentError->testId = runnerData->currentTestId; } /** The Logger. */ @@ -102,12 +82,12 @@ #endif invokeAll(beforeClass); for (testCase = fixture->testCase, testId = fixture->testId; NULL != *testCase; testCase++, testId++) { - currentTestId = *testId; + runnerData->currentTestId = *testId; #ifdef ACEUNIT_LOG_TESTCASE - globalLog(testCaseStarted, currentTestId); + globalLog(testCaseStarted, runnerData->currentTestId); #endif invokeAll(before); - recentError = NULL; + runnerData->recentError = NULL; #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP if (!(setjmp(aceunitJmpBuf))) { #endif @@ -115,16 +95,16 @@ #if ACEUNIT_ASSERTION_STYLE == ACEUNIT_ASSERTION_STYLE_LONGJMP } #endif - testCaseCount++; - if (NULL != recentError) { - globalLog(testCaseFailed, recentError); - testCaseFailureCount++; + runnerData->testCaseCount++; + if (NULL != runnerData->recentError) { + globalLog(testCaseFailed, runnerData->recentError); + runnerData->testCaseFailureCount++; } invokeAll(after); #ifdef ACEUNIT_LOG_TESTCASE - globalLog(testCaseEnded, currentTestId); + globalLog(testCaseEnded, runnerData->currentTestId); #endif - currentTestId = TestCaseId_NULL; + runnerData->currentTestId = TestCaseId_NULL; } invokeAll(afterClass); #ifdef ACEUNIT_LOG_FIXTURE Modified: trunk/src/native/AceUnit.h =================================================================== --- trunk/src/native/AceUnit.h 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/AceUnit.h 2007-12-18 21:25:49 UTC (rev 265) @@ -90,6 +90,12 @@ * Include this header file before AceUnit Data (only applies to framework, not to test cases / generated code). * Use this if you need to specify section information for your compiler e.g. in an embedded environment. * </dd> + * <dt><code>ACEUNIT_DATA_ON_STACK</code></dt> + * <dd> + * Define this macro to use AceUnit Data on the Stack. + * You will then have to initialize #runnerData yourself. + * AceUnit doesn't automatically put it on the stack itself because you might want to access the results from where you invoked the runner. + * </dd> * </dl> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @file AceUnit.h Modified: trunk/src/native/AceUnitData.c =================================================================== --- trunk/src/native/AceUnitData.c 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/AceUnitData.c 2007-12-18 21:25:49 UTC (rev 265) @@ -30,29 +30,22 @@ * @file AceUnitData.c */ -#include "AceUnit.h" +#include "AceUnitData.h" #ifdef ACEUNIT_DATA_INCLUDE #include ACEUNIT_DATA_INCLUDE #endif -/** The most recent error will be remembered here. - * This variable will be set by {@link #recordError()} and read by {@link #runFixture()}. - * It is set to NULL before each test case. - * If it is not NULL after a test case, the test case failed. - */ -AssertionError_t *recentError; +#ifdef ACEUNIT_DATA_ON_STACK -/** This is the most recent error. */ -AssertionError_t recentErrorData; +/** Pointer to the test execution information for the Runner and the Assertions. */ +AceUnitRunnerData_t *runnerData; -/** The id of the currently executed test case. - * This variable will be set by {@link #runFixture()} and read by {@link #recordError()}. - */ -TestCaseId_t currentTestId; +#else -/** The number of test cases that were executed. */ -uint16_t testCaseCount; +/** Test execution information for the Runner and the Assertions. */ +AceUnitRunnerData_t theRunnerData = {0}; -/** The number of test cases that failed. */ -uint16_t testCaseFailureCount; +/** Pointer to the test execution information for the Runner and the Assertions. */ +AceUnitRunnerData_t *runnerData = &theRunnerData; +#endif Added: trunk/src/native/AceUnitData.h =================================================================== --- trunk/src/native/AceUnitData.h (rev 0) +++ trunk/src/native/AceUnitData.h 2007-12-18 21:25:49 UTC (rev 265) @@ -0,0 +1,69 @@ +/* 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 ACEUNITDATA_H +/** Include shield to protect the header file from being included more than once. */ +#define ACEUNITDATA_H 1 + +#include "AceUnit.h" + +/** AceUnitData header file. + * This is only needed when you need to access information used by the runner. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @file AceUnitData.h + */ + +/** Structure with test execution information, used by the Runner and the Assertions. */ +typedef struct { + + /** The most recent error will be remembered here. + * This variable will be set by {@link #recordError()} and read by {@link #runFixture()}. + * It is set to NULL before each test case. + * If it is not NULL after a test case, the test case failed. + */ + AssertionError_t *recentError; + + /** This is the most recent error. */ + AssertionError_t recentErrorData; + + /** The id of the currently executed test case. + * This variable will be set by {@link #runFixture()} and read by {@link #recordError()}. + */ + TestCaseId_t currentTestId; + + /** The number of test cases that were executed. */ + uint16_t testCaseCount; + + /** The number of test cases that failed. */ + uint16_t testCaseFailureCount; + +} AceUnitRunnerData_t; + +/** The test execution information, used by the Runner and the Assertions. */ +extern AceUnitRunnerData_t *runnerData; + +#endif /* ACEUNITDATA_H */ Property changes on: trunk/src/native/AceUnitData.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/src/native/test/basic/AceUnitTest.c =================================================================== --- trunk/src/native/test/basic/AceUnitTest.c 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/basic/AceUnitTest.c 2007-12-18 21:25:49 UTC (rev 265) @@ -36,14 +36,13 @@ #define ACEUNIT_ASSERTION_STYLE ACEUNIT_ASSERTION_STYLE_RETURN +#include "AceUnitData.h" #include "AceUnitTest.h" -extern AssertionError_t* recentError; - /** Clears the current recent error. */ void clearRecentError() { - if (recentError != NULL) { - recentError = NULL; + if (runnerData->recentError != NULL) { + runnerData->recentError = NULL; } } @@ -79,7 +78,7 @@ A_Test void testAssertTrueWithTrueNoRecentError() { clearRecentError(); assertTrue("assertTrue(msg, true) MUST NOT set recentError.", true); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { clearRecentError(); fail("Expected assertTrue(msg, true) to not set recentError."); } @@ -93,7 +92,7 @@ assertTrue("Test assertion, expected to fail.", false); } helper(); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { recentErrorSet = true; } clearRecentError(); @@ -134,7 +133,7 @@ A_Test void testAssertFalseWithFalseNoRecentError() { clearRecentError(); assertFalse("assertFalse(msg, false) MUST NOT set recentError.", false); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { clearRecentError(); fail("Expected recentError to be NULL."); } @@ -148,7 +147,7 @@ assertFalse("Test assertion, expected to fail.", true); } helper(); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { recentErrorSet = true; } clearRecentError(); @@ -195,7 +194,7 @@ int val2 = val1; clearRecentError(); assertEquals("assertEquals(msg, val1, val2) MUST NOT set recentError.", val1, val2); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { clearRecentError(); fail("Expected recentError to be NULL."); } @@ -211,7 +210,7 @@ assertEquals("Test assertion, expected to fail.", val1, val2); } helper(); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { recentErrorSet = true; } clearRecentError(); @@ -230,10 +229,8 @@ */ int main(int argc, char *argv[]) { runFixture(&AceUnitTestFixture); - extern uint16_t testCaseCount; - extern uint16_t testCaseFailureCount; - if (testCaseFailureCount != 0) { - fprintf(stderr, "Test Cases: %d Errors: %d\n", testCaseCount, testCaseFailureCount); + if (runnerData->testCaseFailureCount != 0) { + fprintf(stderr, "Test Cases: %d Errors: %d\n", runnerData->testCaseCount, runnerData->testCaseFailureCount); return 1; } return 0; Modified: trunk/src/native/test/basic/Makefile =================================================================== --- trunk/src/native/test/basic/Makefile 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/basic/Makefile 2007-12-18 21:25:49 UTC (rev 265) @@ -1,6 +1,6 @@ LOGGER=FullPlainLogger -ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitData.h AceUnitData.h AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar ACE_UNIT_PATH=../../../ @@ -24,6 +24,9 @@ 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 $< $@ Modified: trunk/src/native/test/basicEmbedded/AceUnitTest.c =================================================================== --- trunk/src/native/test/basicEmbedded/AceUnitTest.c 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/basicEmbedded/AceUnitTest.c 2007-12-18 21:25:49 UTC (rev 265) @@ -36,14 +36,13 @@ #define ACEUNIT_ASSERTION_STYLE ACEUNIT_ASSERTION_STYLE_RETURN +#include "AceUnitData.h" #include "AceUnitTest.h" -extern AssertionError_t* recentError; - /** Clears the current recent error. */ void clearRecentError() { - if (recentError != NULL) { - recentError = NULL; + if (runnerData->recentError != NULL) { + runnerData->recentError = NULL; } } @@ -79,7 +78,7 @@ A_Test void testAssertTrueWithTrueNoRecentError() { clearRecentError(); assertTrue("assertTrue(msg, true) MUST NOT set recentError.", true); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { clearRecentError(); fail("Expected assertTrue(msg, true) to not set recentError."); } @@ -93,7 +92,7 @@ assertTrue("Test assertion, expected to fail.", false); } helper(); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { recentErrorSet = true; } clearRecentError(); @@ -134,7 +133,7 @@ A_Test void testAssertFalseWithFalseNoRecentError() { clearRecentError(); assertFalse("assertFalse(msg, false) MUST NOT set recentError.", false); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { clearRecentError(); fail("Expected recentError to be NULL."); } @@ -148,7 +147,7 @@ assertFalse("Test assertion, expected to fail.", true); } helper(); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { recentErrorSet = true; } clearRecentError(); @@ -195,7 +194,7 @@ int val2 = val1; clearRecentError(); assertEquals("assertEquals(msg, val1, val2) MUST NOT set recentError.", val1, val2); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { clearRecentError(); fail("Expected recentError to be NULL."); } @@ -211,7 +210,7 @@ assertEquals("Test assertion, expected to fail.", val1, val2); } helper(); - if (recentError != NULL) { + if (runnerData->recentError != NULL) { recentErrorSet = true; } clearRecentError(); @@ -230,10 +229,8 @@ */ int main(int argc, char *argv[]) { runFixture(&AceUnitTestFixture); - extern uint16_t testCaseCount; - extern uint16_t testCaseFailureCount; - if (testCaseFailureCount != 0) { - fprintf(stderr, "Test Cases: %d Errors: %d\n", testCaseCount, testCaseFailureCount); + if (runnerData->testCaseFailureCount != 0) { + fprintf(stderr, "Test Cases: %d Errors: %d\n", runnerData->testCaseCount, runnerData->testCaseFailureCount); return 1; } return 0; Modified: trunk/src/native/test/basicEmbedded/Makefile =================================================================== --- trunk/src/native/test/basicEmbedded/Makefile 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/basicEmbedded/Makefile 2007-12-18 21:25:49 UTC (rev 265) @@ -1,6 +1,6 @@ LOGGER=MiniRamLogger -ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitData.h AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar ACE_UNIT_PATH=../../../ @@ -24,6 +24,9 @@ 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 $< $@ Modified: trunk/src/native/test/longjmp/LongJmpTest.c =================================================================== --- trunk/src/native/test/longjmp/LongJmpTest.c 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/longjmp/LongJmpTest.c 2007-12-18 21:25:49 UTC (rev 265) @@ -37,6 +37,7 @@ #define ACEUNIT_ASSERTION_STYLE ACEUNIT_ASSERTION_STYLE_LONGJMP #include "LongJmpTest.h" +#include "AceUnitData.h" /** Tests that {@link #assertTrue()} does a longjmp. */ A_Test void testAssertDoesLongjmp() { @@ -65,10 +66,8 @@ */ int main(int argc, char *argv[]) { runFixture(&LongJmpTestFixture); - extern uint16_t testCaseCount; - extern uint16_t testCaseFailureCount; - if (testCaseFailureCount != 2) { - fprintf(stderr, "Test Cases: %d Errors: %d (expecting 2)\n", testCaseCount, testCaseFailureCount); + if (runnerData->testCaseFailureCount != 2) { + fprintf(stderr, "Test Cases: %d Errors: %d (expecting 2)\n", runnerData->testCaseCount, runnerData->testCaseFailureCount); return 1; } return 0; Modified: trunk/src/native/test/longjmp/Makefile =================================================================== --- trunk/src/native/test/longjmp/Makefile 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/longjmp/Makefile 2007-12-18 21:25:49 UTC (rev 265) @@ -1,7 +1,7 @@ LOGGER=FullPlainLogger #LOGGER=MiniRamLogger -ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitData.h AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar ACE_UNIT_PATH=../../../ @@ -25,6 +25,9 @@ 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 $< $@ Modified: trunk/src/native/test/recursive/Makefile =================================================================== --- trunk/src/native/test/recursive/Makefile 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/recursive/Makefile 2007-12-18 21:25:49 UTC (rev 265) @@ -1,7 +1,7 @@ LOGGER=FullPlainLogger #LOGGER=MiniRamLogger -ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitData.h AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar ACE_UNIT_PATH=../../../ @@ -31,6 +31,9 @@ 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 $< $@ Modified: trunk/src/native/test/recursive/TestMain.c =================================================================== --- trunk/src/native/test/recursive/TestMain.c 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/recursive/TestMain.c 2007-12-18 21:25:49 UTC (rev 265) @@ -30,6 +30,7 @@ */ #include "AceUnit.h" +#include "AceUnitData.h" #include <stdio.h> /** The fixtures. */ @@ -60,8 +61,8 @@ */ int main(int argc, char *argv[]) { runFixtures(fixtures); - if (testCaseFailureCount != 0) { - fprintf(stderr, "Error: %d test cases failed.\n", (int) testCaseFailureCount); + if (runnerData->testCaseFailureCount != 0) { + fprintf(stderr, "Error: %d test cases failed.\n", (int) runnerData->testCaseFailureCount); return 1; } else { return 0; Modified: trunk/src/native/test/twoFixtures/Makefile =================================================================== --- trunk/src/native/test/twoFixtures/Makefile 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/twoFixtures/Makefile 2007-12-18 21:25:49 UTC (rev 265) @@ -1,7 +1,7 @@ LOGGER=FullPlainLogger #LOGGER=MiniRamLogger -ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitData.h AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar ACE_UNIT_PATH=../../../ @@ -28,6 +28,9 @@ 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 $< $@ Modified: trunk/src/native/test/twoFixtures/RunTest.c =================================================================== --- trunk/src/native/test/twoFixtures/RunTest.c 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/twoFixtures/RunTest.c 2007-12-18 21:25:49 UTC (rev 265) @@ -37,6 +37,7 @@ #define ACEUNIT_ASSERTION_STYLE ACEUNIT_ASSERTION_STYLE_RETURN #include "AceUnit.h" +#include "AceUnitData.h" extern TestFixture_t Fixture1Fixture; extern TestFixture_t Fixture2Fixture; @@ -50,12 +51,10 @@ * @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); + if (runnerData->testCaseFailureCount != 0) { + fprintf(stderr, "Test Cases: %d Errors: %d\n", runnerData->testCaseCount, runnerData->testCaseFailureCount); return 1; } return 0; Modified: trunk/src/native/test/xmlLog/Makefile =================================================================== --- trunk/src/native/test/xmlLog/Makefile 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/xmlLog/Makefile 2007-12-18 21:25:49 UTC (rev 265) @@ -1,6 +1,6 @@ LOGGER=JUnitXmlLogger -ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar +ACE_UNIT_FILES=AceUnit.c AceUnit.h AceUnitData.c AceUnitData.h AceUnitAnnotations.h AceUnitLogging.h $(LOGGER).c AceUnit.jar ACE_UNIT_PATH=../../../ @@ -24,6 +24,9 @@ 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 $< $@ Modified: trunk/src/native/test/xmlLog/XmlLogTest.c =================================================================== --- trunk/src/native/test/xmlLog/XmlLogTest.c 2007-12-18 00:42:44 UTC (rev 264) +++ trunk/src/native/test/xmlLog/XmlLogTest.c 2007-12-18 21:25:49 UTC (rev 265) @@ -35,6 +35,7 @@ #include <stdio.h> #include "XmlLogTest.h" +#include "AceUnitData.h" #include "AceUnitLogging.h" A_Test void test1() { @@ -55,11 +56,9 @@ int main(int argc, char *argv[]) { globalLogger->runnerStarted(); runFixture(&XmlLogTestFixture); - extern uint16_t testCaseCount; - extern uint16_t testCaseFailureCount; globalLogger->runnerEnded(); - if (testCaseFailureCount != 0) { - fprintf(stderr, "Test Cases: %d Errors: %d\n", testCaseCount, testCaseFailureCount); + if (runnerData->testCaseFailureCount != 0) { + fprintf(stderr, "Test Cases: %d Errors: %d\n", runnerData->testCaseCount, runnerData->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-12-18 00:42:48
|
Revision: 264 http://aceunit.svn.sourceforge.net/aceunit/?rev=264&view=rev Author: christianhujer Date: 2007-12-17 16:42:44 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Updated release info on homepage. Modified Paths: -------------- trunk/src/doc/start.xhtml Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2007-12-18 00:17:24 UTC (rev 263) +++ trunk/src/doc/start.xhtml 2007-12-18 00:42:44 UTC (rev 264) @@ -20,7 +20,7 @@ </div> --> <p> - Latest release version: <strong>aceunit-0.3.2</strong> + Latest release version: <strong>aceunit-0.4</strong> </p> <h2>What is AceUnit?</h2> <!-- The description must match the project description at http://sourceforge.net/projects/aceunit/ --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-12-18 00:17:28
|
Revision: 263 http://aceunit.svn.sourceforge.net/aceunit/?rev=263&view=rev Author: christianhujer Date: 2007-12-17 16:17:24 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Creating release tag 0.4 for branch 0.4. Added Paths: ----------- tags/0.4/ Copied: tags/0.4 (from rev 262, branches/0.4) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-12-18 00:16:03
|
Revision: 262 http://aceunit.svn.sourceforge.net/aceunit/?rev=262&view=rev Author: christianhujer Date: 2007-12-17 16:16:01 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Created branch for 0.4. Added Paths: ----------- branches/0.4/ Copied: branches/0.4 (from rev 261, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-12-18 00:03:17
|
Revision: 261 http://aceunit.svn.sourceforge.net/aceunit/?rev=261&view=rev Author: christianhujer Date: 2007-12-17 16:03:19 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Fixed broken xml. Modified Paths: -------------- trunk/src/doc/start.xhtml Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2007-12-18 00:01:25 UTC (rev 260) +++ trunk/src/doc/start.xhtml 2007-12-18 00:03:19 UTC (rev 261) @@ -45,7 +45,7 @@ <!--li><a href="news/">AceUnit Project News</a></li--> <!--li><a href="faq">AceUnit FAQ</a> (Frequently Asked Questions)</li--> <li><a href="history">History of AceUnit</a></li> - <li>AceUnit Presentation: <a href="http://www.riedquat.de/projects/aceunit/AceUnit.pptx">PowerPoint 2007</a>, <a href="http://www.riedquat.de/projects/aceunit/AceUnit.pdf">PDF</a>. + <li>AceUnit Presentation: <a href="http://www.riedquat.de/projects/aceunit/AceUnit.pptx">PowerPoint 2007</a>, <a href="http://www.riedquat.de/projects/aceunit/AceUnit.pdf">PDF</a>.</li> </ul> <h2>Contact the AceUnit developers</h2> <p>There are many ways of contacting the AceUnit developers.</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-12-18 00:01:40
|
Revision: 260 http://aceunit.svn.sourceforge.net/aceunit/?rev=260&view=rev Author: christianhujer Date: 2007-12-17 16:01:25 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Added links to AceUnit presentations. Modified Paths: -------------- trunk/src/doc/start.xhtml Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2007-12-17 23:42:20 UTC (rev 259) +++ trunk/src/doc/start.xhtml 2007-12-18 00:01:25 UTC (rev 260) @@ -45,6 +45,7 @@ <!--li><a href="news/">AceUnit Project News</a></li--> <!--li><a href="faq">AceUnit FAQ</a> (Frequently Asked Questions)</li--> <li><a href="history">History of AceUnit</a></li> + <li>AceUnit Presentation: <a href="http://www.riedquat.de/projects/aceunit/AceUnit.pptx">PowerPoint 2007</a>, <a href="http://www.riedquat.de/projects/aceunit/AceUnit.pdf">PDF</a>. </ul> <h2>Contact the AceUnit developers</h2> <p>There are many ways of contacting the AceUnit developers.</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-12-17 23:43:12
|
Revision: 259 http://aceunit.svn.sourceforge.net/aceunit/?rev=259&view=rev Author: christianhujer Date: 2007-12-17 15:42:20 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Added Force option to overwrite files even if write protected. Modified Paths: -------------- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.java =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-12-17 23:23:12 UTC (rev 258) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.java 2007-12-17 23:42:20 UTC (rev 259) @@ -36,6 +36,7 @@ import java.util.List; import net.sf.japi.io.args.ArgParser; import net.sf.japi.io.args.BasicCommand; +import net.sf.japi.io.args.Option; import org.jetbrains.annotations.NotNull; /** Program for generating the code that's needed to execute a fixture. @@ -69,12 +70,23 @@ ArgParser.simpleParseAndRun(new GenTest(), args); } + /** Whether to overwrite write-protected files. */ + private boolean force; + /** Creates a GenTest instance. * @throws IOException in case of I/O problems. */ public GenTest() throws IOException { } + /** Sets whether overwriting of existing files should be enforced. + * @param force Whether overwriting of existing files should be enforced. + */ + @Option({"f", "force"}) + public void setForce(final boolean force) { + this.force = force; + } + /** 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. @@ -148,6 +160,9 @@ final File hFile = new File(fixtureFile.getParent(), fixtureName + ".h"); final String hSource = fixture.getFixtureCode(fixtureName); if (!hFile.exists() || !hSource.equals(readSource(hFile))) { + if (force) { + hFile.setWritable(true); + } final PrintWriter out = new PrintWriter(new FileWriter(hFile)); out.append(hSource); out.close(); Modified: trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties =================================================================== --- trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties 2007-12-17 23:23:12 UTC (rev 258) +++ trunk/src/java/src/prj/net/sf/aceunit/GenTest.properties 2007-12-17 23:42:20 UTC (rev 259) @@ -26,3 +26,5 @@ helpHeader=Usage: java -jar AceUnit.jar [OPTION] [BASENAME]...\nCreate AceUnit unit test headers for one or more modules with the specified basename (omit .c suffix).\n helpFooter=Examples:\n java -jar AceUnit.jar sortTest >sortTest.h\n +setForce=Overwrite write-protected files. +setNoForce=Do not overwrite write-protected files. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |