From: Tero Koskinen on
Hi,

I released Ahven 1.8 today. It can be downloaded from
http://sourceforge.net/projects/ahven/files/

Ahven is a unit testing library for Ada 95
programming language.

Version 1.8 is a bugfix release with following changes:

* Fix for double free when mixing dynamically
allocated test cases with statically allocated
test suites.

* Support for dynamic libraries was dropped.
It was too complex (for me) to maintain
Makefile/GPR-file logic which would work
in the same way on Fedora, Debian, OpenBSD,
and Windows.

If some packagers (like Debian people) want
to enable support they can apply Makefiles
and GNAT project files from Ahven 1.7 on
top of 1.8.

* Support for Janus/Ada 3.1.1d was dropped.
Janus/Ada 3.1.2beta or newer is required.

Janus/Ada 3.1.1d support required too many
work-arounds, so to make my life easier
I decided to drop the support.

If someone needs this, I welcome patches. :)

* TAP 1.3 test result format was dropped.
Version 1.2 is supported.

The release has been tested with following compilers:
* FSF GCC/GNAT 4.3.5 and 4.4.4
* GNAT GPL 2009
* Janus/Ada 3.1.2beta
* Irvine ICCAda

The code can be compiled either as plain Ada 95 or
as Ada 2005 code.

--
Tero Koskinen - http://iki.fi/tero.koskinen/
From: Stephen Leake on
Tero Koskinen <tero.koskinen(a)iki.fi> writes:

> Hi,
>
> I released Ahven 1.8 today. It can be downloaded from
> http://sourceforge.net/projects/ahven/files/
>
> Ahven is a unit testing library for Ada 95
> programming language.

Is this actually restricted to Ada 95? What prevents it from being used
with Ada 2005?

How does it compare to AUnit?

> The code can be compiled either as plain Ada 95 or
> as Ada 2005 code.

Ah; much better. Perhaps you should fix the intro statement to just say
"Ada"; no one will be surprised if it doesn't work with an Ada 83
compiler.

--
-- Stephe
From: Dan on
On Jun 3, 5:08 am, Stephen Leake <stephen_le...(a)stephe-leake.org>
wrote:
> How does it compare to AUnit?

I am able to use Ahven in a table-driven manner, as shown below.
But I don't see a way to use AUnit similarly (replacing the Ahven-
specific code below the line of dashes).


with text_io;
procedure p1 is begin text_io.put_line("in p1"); end;

with text_io;
procedure p2 is begin text_io.put_line("in p2"); end;

with text_io;
procedure p3 is begin text_io.put_line("in p3"); end;


with text_io;
procedure q1 is begin text_io.put_line("in q1"); end;

with text_io;
procedure q2 is begin text_io.put_line("in q2"); end;

with text_io;
procedure q3 is begin text_io.put_line("in q3"); end;


package test_suite is

type proc_access is access procedure;
type rec is record
proc: proc_access;
name: access string;
end record;
type suite_type is array(natural range <>) of rec;

generic
suite_name: string;
suite_arr: suite_type;
package suites is
end suites;

function "+"(s: string) return access string;
end test_suite;

package body test_suite is

function "+"(s: string) return access string is
begin
return new string'(s);
end;
end test_suite;


with p1, p2, p3;
with test_suite; use test_suite;
package p_suite is new test_suite.suites(
suite_name => "p",
suite_arr => (
(p1'access, +"p1"),
(p2'access, +"p3"),
(p3'access, +"p3")));

with test_suite; use test_suite;
package q_suite is new test_suite.suites(
suite_name => "q",
suite_arr => (
(q1'access, +"q1"),
(q2'access, +"q3"),
(q3'access, +"q3")));

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

with ahven.framework;
with test_suite;
generic
S : Ahven.Framework.Test_Suite_Access;
with package the_suite is new test_suite.suites(<>);
package one_suite is
type test is new ahven.framework.test_case with null record;
procedure initialize (T: in out test);
end;

package body one_suite is

procedure initialize (T: in out test) is
begin
set_name(T, the_suite.suite_name);
for i in the_suite.suite_arr'range loop
ahven.framework.add_test_routine (T,
ahven.framework.Simple_Test_Routine_Access(
the_suite.suite_arr(i).proc),
the_suite.suite_arr(i).name.all);
end loop;
end;

begin
Ahven.Framework.Add_Test (S.all, new Test);
end one_suite;


with p_suite;
with q_suite;
with one_suite;
with ahven.framework;
package all_suites is
S : Ahven.Framework.Test_Suite_Access :=
Ahven.Framework.Create_Suite ("acats C tests");

package suite_p is new one_suite(S, p_suite);
package suite_q is new one_suite(S, q_suite);
end all_suites;


with all_suites; use all_suites;
with Ahven.Text_Runner;
with Ahven.Framework;
procedure main is
begin
Ahven.Text_Runner.Run (S);
Ahven.Framework.Release_Suite (S);
end main;

From: Dan on
On Jun 3, 12:36 pm, Dan <d...(a)irvine.com> wrote:

with q1, q2, q3; -- oops, this line was missing!
> with test_suite; use test_suite;
> package q_suite is new test_suite.suites(
>      suite_name => "q",
>      suite_arr => (
>         (q1'access, +"q1"),
>         (q2'access, +"q3"),
>         (q3'access, +"q3")));
>
From: Stephen Leake on
Dan <dan(a)irvine.com> writes:

> On Jun 3, 5:08 am, Stephen Leake <stephen_le...(a)stephe-leake.org>
> wrote:
>> How does it compare to AUnit?
>
> I am able to use Ahven in a table-driven manner, as shown below.
> But I don't see a way to use AUnit similarly (replacing the Ahven-
> specific code below the line of dashes).
>
>
> ...

> with p1, p2, p3;
> with test_suite; use test_suite;
> package p_suite is new test_suite.suites(
> suite_name => "p",
> suite_arr => (
> (p1'access, +"p1"),
> (p2'access, +"p3"),
> (p3'access, +"p3")));

In AUnit, tests are 'registered' in a test_case:

overriding procedure Register_Tests (T : in out Test_Case)
is
begin
Register_Routine (T, Nominal'Access, "Nominal");
Register_Routine (T, Commands'Access, "Commands");
Register_Routine (T, Glitches'Access, "Glitches");
Register_Routine (T, Multi_Cycle'Access, "Multi_Cycle");
end Register_Tests;

Then test_cases are added to suites:

Add_Test (Suite, new Test_Hardware.Analog_In_Out_Wrappers.Test_Case);
Add_Test (Suite, new Test_Hardware.Analog_In_Wrapper_Common.Test_Case);
Add_Test (Suite, new Test_Hardware.Analog_Out_Wrapper_Common.Test_Case);

This seems roughly equivalent to Ahven.

AUnit also has setup and teardown functions for initializing and finalizing
each test and/or each Test_Case; those are very helpful.

--
-- Stephe