Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   syntactically comprehensive test program (http://www.velocityreviews.com/forums/t446436-syntactically-comprehensive-test-program.html)

nobrow@gmail.com 02-28-2007 11:41 AM

syntactically comprehensive test program
 
I need a syntactically comprehensive test program to test a C parser
on. Does anyone know where I might find a program that uses all
syntactical elements of the language and combines them in cunning/
realistic ways so that one might be confident that a pass on this
program will mean a pass on any valid C program.

Big ask, but I thought someone might know of a suitable file(s).


santosh 02-28-2007 11:46 AM

Re: syntactically comprehensive test program
 
nob...@gmail.com wrote:
> I need a syntactically comprehensive test program to test a C parser
> on. Does anyone know where I might find a program that uses all
> syntactical elements of the language and combines them in cunning/
> realistic ways so that one might be confident that a pass on this
> program will mean a pass on any valid C program.
>
> Big ask, but I thought someone might know of a suitable file(s).


gcc comes bundled with it's own test routines. I also think P.J.
Plauger's dinkumware.com offers to certify compilers and libraries for
standard conformance.


user923005 02-28-2007 08:01 PM

Re: syntactically comprehensive test program
 
On Feb 28, 3:41 am, nob...@gmail.com wrote:
> I need a syntactically comprehensive test program to test a C parser
> on. Does anyone know where I might find a program that uses all
> syntactical elements of the language and combines them in cunning/
> realistic ways so that one might be confident that a pass on this
> program will mean a pass on any valid C program.
>
> Big ask, but I thought someone might know of a suitable file(s).



http://www.plumhall.com/suites.html
http://www.opengroup.org/testing/tes...s/perenial.htm
http://www.ace.nl/compiler/supertest.html
There's a few gazillion more here:
http://www.google.com/search?q=C+val...&start=10&sa=N


Keith Thompson 02-28-2007 08:06 PM

Re: syntactically comprehensive test program
 
"santosh" <santosh.k83@gmail.com> writes:
> nob...@gmail.com wrote:
>> I need a syntactically comprehensive test program to test a C parser
>> on. Does anyone know where I might find a program that uses all
>> syntactical elements of the language and combines them in cunning/
>> realistic ways so that one might be confident that a pass on this
>> program will mean a pass on any valid C program.
>>
>> Big ask, but I thought someone might know of a suitable file(s).

>
> gcc comes bundled with it's own test routines. I also think P.J.
> Plauger's dinkumware.com offers to certify compilers and libraries for
> standard conformance.


I haven't looked at gcc's test suite. I'm sure it includes tests for
gcc-specific extensions. Before using it, make sure that those tests
are cleanly separated from the ones that use only standard C.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Malcolm McLean 02-28-2007 08:12 PM

Re: syntactically comprehensive test program
 
<nobrow@gmail.com> wrote in message
>I need a syntactically comprehensive test program to test a C parser
> on. Does anyone know where I might find a program that uses all
> syntactical elements of the language and combines them in cunning/
> realistic ways so that one might be confident that a pass on this
> program will mean a pass on any valid C program.
>
> Big ask, but I thought someone might know of a suitable file(s).
>

Look for a program called C torture, which is designed to stress compilers.

Unfortunately it is extremely difficult to verify that a grammar parser is
correct. Non-artificial bugs will often fail to manifest themselves on the
vast majority of inputs. C torture is a good test, but not definitive by any
means, which is why ANSI haven't endorsed it or any similar test suite.


--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm


user923005 02-28-2007 08:33 PM

Re: syntactically comprehensive test program
 
Too bad NIST never wrote one for C. There testers for other languages
are really good.
http://www.itl.nist.gov/div897/ctg/software.htm#pubsoft

I use their SQL test suite all the time, and it is fantastic.


CBFalconer 02-28-2007 10:59 PM

Re: syntactically comprehensive test program
 
Malcolm McLean wrote:
> <nobrow@gmail.com> wrote in message
>
>> I need a syntactically comprehensive test program to test a C
>> parser on. Does anyone know where I might find a program that
>> uses all syntactical elements of the language and combines them
>> in cunning/realistic ways so that one might be confident that a
>> pass on this program will mean a pass on any valid C program.
>>
>> Big ask, but I thought someone might know of a suitable file(s).

>
> Look for a program called C torture, which is designed to stress
> compilers.
>
> Unfortunately it is extremely difficult to verify that a grammar
> parser is correct. Non-artificial bugs will often fail to
> manifest themselves on the vast majority of inputs. C torture is
> a good test, but not definitive by any means, which is why ANSI
> haven't endorsed it or any similar test suite.


It is hard to test that a compiler system is correct. It is much
easier to test that it adheres to a specific clause in the
standard. This was the approach taken 25 years ago in the Pascal
Test Suite, which unfortunately got hidden by Prospero, when the
original had been open to all.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>




All times are GMT. The time now is 10:10 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.