comp.lang.ada
 help / color / mirror / Atom feed
* ANNOUNCE: `tg', a test driver generator for Ada programs
@ 1996-05-09  0:00 Andre Spiegel
  1996-05-10  0:00 ` Ray Mosley
  1996-05-13  0:00 ` Andre Spiegel
  0 siblings, 2 replies; 4+ messages in thread
From: Andre Spiegel @ 1996-05-09  0:00 UTC (permalink / raw)



`tg', a simple test driver generator for Ada programs, can now be
found under the address

     ftp.informatik.uni-stuttgart.de:/pub/local/tg-3.0.tar.gz

I wrote this little helper some time ago, found it pretty useful, and
finally bundled it for release.  What is `tg'?  Here's an extract from
the README file:

---------------------------------------------------------------------------

tg is a program that helps testing software.  If you want to test a
piece of software, that normally means you have to execute it over and
over again, passing various sets of input data to it, and verifying
that it gives the correct results for each input.  You normally write
a program that does all this automatically.  Such a program is called
a "test driver".

tg can generate such test driver programs, given a very succinct
description of the individual test cases.  tg translates this
description into a complete Ada program.  If you compile this
test driver, link it with the software you want to test, and execute
it, it performs all the test cases and tells you whether the software
under test behaved as expected or not.

tg is designed for the Ada programming language, but you can also use
it for software written in other languages.  You might even test
binary programs with it, of which you don't have the source code at
all.

---------------------------------------------------------------------------

Here's a small example.  Suppose you want to test an Ada function
which counts the number of `&' characters within a given string.

     function Count_Ampersand (Str : in String) return Natural;

   One of your test cases might be to call it with parameter
"abc&&&abc" and verify that the result is three.  The code for this
could look as follows.

     Put ("Testing three ampersands in the middle... ");
     begin
       Count := Count_Ampersand ("abc&&&abc");
       if Count = 3 then
         Put_Line ("pass.");
       else
         Put_Line ("fail.");
       end if;
     exception
       when others =>
         Put_Line ("fail.");
     end;

   That is a lot of code for a single test case.  In `tg' notation, to
specify this test case, you would just write:

     ***** Testing three ampersands in the middle...
     test Count := Count_Ampersand ("abc&&&abc");
     pass Count = 3

   The `tg' command translates this into code similar to that shown
above and puts it into a complete driver program.

---------------------------------------------------------------------------

`tg' is written in Ada 95 and compiles out-of-the-box with GNAT, the
GNU Ada Compiler, version 3.01 or higher.  Documentation is provided
as a GNU texinfo manual, and in postscript form.  `tg' is free
software, released under the FSF's General Public License (GPL).

Comments, suggestions, etc. are welcome.

Andre Spiegel                    
University of Stuttgart, Germany
<spiegel@berlin.informatik.uni-stuttgart.de>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ANNOUNCE: `tg', a test driver generator for Ada programs
  1996-05-09  0:00 ANNOUNCE: `tg', a test driver generator for Ada programs Andre Spiegel
@ 1996-05-10  0:00 ` Ray Mosley
  1996-05-11  0:00   ` Mike Young
  1996-05-13  0:00 ` Andre Spiegel
  1 sibling, 1 reply; 4+ messages in thread
From: Ray Mosley @ 1996-05-10  0:00 UTC (permalink / raw)



In article <lhmenou9dxo.fsf@berlin.berlin.informatik.uni-stuttgart.de>, Andre Spiegel <spiegel@berlin.informatik.uni-stuttgart.de> writes:
|> `tg', a simple test driver generator for Ada programs, can now be
|> found under the address
...snip
|> tg is designed for the Ada programming language, but you can also use
|> it for software written in other languages.  You might even test
|> binary programs with it, of which you don't have the source code at
|> all.
|> 
|> ---------------------------------------------------------------------------
|> 
|> Here's a small example.  Suppose you want to test an Ada function
|> which counts the number of `&' characters within a given string.
...snip
|>      ***** Testing three ampersands in the middle...
|>      test Count := Count_Ampersand ("abc&&&abc");
|>      pass Count = 3
|> 
|>    The `tg' command translates this into code similar to that shown
|> above and puts it into a complete driver program.
|> 
|> ---------------------------------------------------------------------------


Could you perhaps give some examples of other languages, like tcl itself,
as well as C/C++?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ANNOUNCE: `tg', a test driver generator for Ada programs
  1996-05-10  0:00 ` Ray Mosley
@ 1996-05-11  0:00   ` Mike Young
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Young @ 1996-05-11  0:00 UTC (permalink / raw)



Ray Mosley wrote:
> 
> ...snip
> |>      ***** Testing three ampersands in the middle...
> |>      test Count := Count_Ampersand ("abc&&&abc");
> |>      pass Count = 3
> |>
> |>    The `tg' command translates this into code similar to that shown
> |> above and puts it into a complete driver program.
> |>
> |> ---------------------------------------------------------------------------
> 
> Could you perhaps give some examples of other languages, like tcl itself,
> as well as C/C++?


===========
This shouldn't be necessary in C++ or C. This is one of the few places 
where macros are justified and useful. 

Mike.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ANNOUNCE: `tg', a test driver generator for Ada programs
  1996-05-09  0:00 ANNOUNCE: `tg', a test driver generator for Ada programs Andre Spiegel
  1996-05-10  0:00 ` Ray Mosley
@ 1996-05-13  0:00 ` Andre Spiegel
  1 sibling, 0 replies; 4+ messages in thread
From: Andre Spiegel @ 1996-05-13  0:00 UTC (permalink / raw)



Ray Mosley writes:

> Could you perhaps give some examples of other languages, like tcl itself,
> as well as C/C++?

To use `tg' with other languages, you need to `interface' that
software to Ada, because the generated driver is always an Ada
program.  The driver must be able to call the software, and retrieve
the results somehow, that's all.  For example, to test a binary
program, you can call it from Ada as a subprocess.

Given the great inter-language features of Ada 95, this is a fairly
easy task, but I agree that it might be too much work to do it on a
regular basis.

The example I gave is a very simple one.  Have a look at the docs,
there are a few more things that `tg' can do.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-05-13  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-09  0:00 ANNOUNCE: `tg', a test driver generator for Ada programs Andre Spiegel
1996-05-10  0:00 ` Ray Mosley
1996-05-11  0:00   ` Mike Young
1996-05-13  0:00 ` Andre Spiegel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox