Re: How do I generate test suite code for C?

On Sat, 16 Mar 2002 10:41:07 -0600
"Curt Arnold" <carnold@houston.rr.com> wrote:

> Michael B Allan wrote:
> > I'm the author of a plain C implementation called DOMC. I would like to
> > generate conformance test sources like:
> 
> Welcome.  Yes, the right approach is to create a new transform
> test-to-domc.xsl that would generate source code compatible with your C
> binding and your selected test harness.  If you aren't already using a test
> harness, there is a list of xUnit implementations at
> http://www.xprogramming.com/software.htm  Though the tests can be adapted to
> other frameworks, the Java code outputs JUnit style assertions.

Done. Looks like 'Check' is pretty good.

  http://check.sourceforge.net/

> The packaged test suite is basically a binary drop, to build your own
> transforms you need to get the sources out of the CVS.  See
> http://www.w3.org/DOM/Test/Documents/DOMTSBuild.html for details on how to
> access the CVS repository and build the test suite.

Done. But I'm getting errors after 284 successfull transformations:

    [style] Transforming into /home/miallen/p/c/domts/2001/DOM-Test-Suite/build/java/org/w3c/domts/level1/core
    [style] Transforming into /home/miallen/p/c/domts/2001/DOM-Test-Suite/build/java/org/w3c/domts/level1/core
    [style] Transforming into /home/miallen/p/c/domts/2001/DOM-Test-Suite/build/java/org/w3c/domts/level1/core
    [style] file:////home/miallen/p/c/domts/2001/DOM-Test-Suite/transforms/test-to-java.xsl; Line 326; Column 68; Can not load requested doc: nodeelementnodeattributes.xml
    [style] file:////home/miallen/p/c/domts/2001/DOM-Test-Suite/transforms/test-to-java.xsl; Line 326; Column 68; Can not load requested doc: nodeelementnodename.xml
    [style] file:////home/miallen/p/c/domts/2001/DOM-Test-Suite/transforms/test-to-java.xsl; Line 326; Column 68; Can not load requested doc: nodeelementnodetype.xml
    [style] file:////home/miallen/p/c/domts/2001/DOM-Test-Suite/transforms/test-to-java.xsl; Line 326; Column 68; Can not load requested doc: nodeelementnodetype.xml
    [style] file:////home/miallen/p/c/domts/2001/DOM-Test-Suite/transforms/test-to-java.xsl; Line 328; Column 49; Can not load requested doc: nodeelementnodetype.xml
    [style] file:////home/miallen/p/c/domts/2001/DOM-Test-Suite/transforms/test-to-java.xsl; Line 328; Column 49; Can not load requested doc: nodeelementnodetype.xml
    [style] file:////home/miallen/p/c/domts/2001/DOM-Test-Suite/transforms/test-to-java.xsl; Line 326; Column 68; Can not load requested doc: nodeelementnodevalue.xml
...etc

> Then I would manually convert some of the tests to your DOM binding and
> selected test framework, write the necessary supporting code (the C
> equivalent of DOMTestCase.java), get those tests running,

Done. Works like a champ.

[miallen@nano c]$ make
gcc -Wall -DLOADBASE=\"../tests/level1/core/files/\" -ldomc testdomc_level1_suite.c -o testdomc testdomc.c /usr/local/lib/libcheck.a
testdomc_level1_suite.c: In function `nodecommentnodename':
testdomc_level1_suite.c:14: warning: unused variable `commentName'
[miallen@nano c]$ ./testdomc 
Running suite(s): Level1
75%: Checks: 4, Failures: 1, Errors: 0
testdomc_level1_suite.c:27:P:Core: Passed
testdomc_level1_suite.c:47:P:Core: Passed
testdomc_level1_suite.c:62:P:Core: Passed
testdomc_level1_suite.c:80:F:Core: DTD default values are not supported

> and then create
> test-to-domc.xsl from test-to-java.xsl.  test-to-java is numbingly complex,
> so if you get a few manual tests up and running, then we could collaborate
> to get test-to-domc to produce the code.

This does look pretty freaky. I don't know dirt about XSLT. If I line
everything up how much are you willing to help with the stylesheet?

> We have yet to do any test suites for anything other than the two official
> bindings, Java and ECMAScript.  There has been a desire to incorporate test
> generation for other bindings (Python and C#+System.XML in particular) in
> the package, but the need for sleep has precluded doing anything serious on
> it.  I don't know if you'd be interested in trying to tackle both DOMC and
> other C bindings like libxml as a combined effort that could be contributed
> to the W3C.

Do you mean gdome2? I'm not particularly familiar with the whole GNOME
envoronment but I think they could copy and modify my test suites much
more easily than it will be for me to get mine working.

> We are using Ant (http://jakarta.apache.org/ant) as our build tool.
> Coincidentally, I've been working on a C/C++ compilation task for Ant as
> part of http://ant-contrib.sourceforge.net which might be useful later.

That's a big task (pun intended) :~)

Mike

-- 
May The Source be with you.

Received on Saturday, 16 March 2002 21:04:09 UTC