From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2273a296de8c1b6d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder.news-service.com!newsfeed1.swip.net!newsfeed1.funet.fi!newsfeed3.funet.fi!newsfeeds.funet.fi!fi.sn.net!newsfeed2.tdcnet.fi!news.song.fi!not-for-mail Date: Fri, 4 Jun 2010 18:37:08 +0300 From: Tero Koskinen Newsgroups: comp.lang.ada Subject: Re: ANN: Ahven 1.8 Message-Id: <20100604183708.2ff8bfd3.tero.koskinen@iki.fi> References: <20100602192413.ff36db38.tero.koskinen@iki.fi> <82ocfs1fpv.fsf@stephe-leake.org> <357172d2-0e3f-4700-bcbb-3351f93c8372@s1g2000prf.googlegroups.com> <827hmf17i8.fsf@stephe-leake.org> X-Newsreader: Sylpheed 2.7.1 (GTK+ 2.20.1; x86_64-unknown-openbsd4.7) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Organization: NBL Networks Oy NNTP-Posting-Host: 217.30.184.161 X-Trace: 1275665829 news.nbl.fi 4151 217.30.184.161:39715 X-Complaints-To: abuse@nblnetworks.fi Xref: g2news1.google.com comp.lang.ada:11284 Date: 2010-06-04T18:37:08+03:00 List-Id: On Fri, 04 Jun 2010 05:17:51 -0400 Stephen Leake wrote: > Dan writes: >=20 > > On Jun 3, 5:08=A0am, Stephen Leake > > wrote: > >> How does it compare to AUnit? Here a little summary: * The basic API is similar in Ahven and AUnit 1 (and 3). * In Ahven, I have the public API stuffed into two packages: Ahven and Ahven.Framework while AUnit spreads it API into larger amount of packages. * AUnit is Ada 2005 code only and I think it can be compiled only with GNAT (not 100% sure since I haven't tried it with other Ada 2005 compilers) * Ahven is Ada 95 code, but can be compiled as Ada 2005 code also. I have seen some effort to make Ahven build out of the box with several Ada 95 or Ada 2005 compilers. So far, GNAT, Janus/Ada, ObjectAda, and ICCAda have been tested. (Unix and Windows environments) =20 I don't know about IBM/Rational Apex, GHS AdaMulti, or PowerAda, but I suspect that they should be okay also. * Both are free or open-source software. AUnit is distributed under GPL and Ahven under ISC license (similar to BSD). * Both libraries support XML results, but AUnit uses CppUnit's XML format while Ahven uses JUnit's format. In addition, Ahven can output test results in Test-Anything-Protocol (TAP) format, which is my favorite at the moment. * AUnit's documentation is probably better. So far I have concentrated on the code. > In AUnit, tests are 'registered' in a test_case: >=20 > overriding procedure Register_Tests (T : in out Test_Case) > is > begin > Register_Routine (T, Nominal'Access, "Nominal"); Same works for Ahven. Dan's example was just somewhat exotic, so one couldn't figure it out from that. procedure Initialize (T: in out Test_Case) is procedure Register_Routine (T : in out Ahven.Framework.Test_Case'Class; Routine : Simple_Test_Routine_Access; Name : String) renames Ahven.Framework.Add_Test_Routine; begin Register_Routine (T, Nominal'Access, "Nominal"); ...; The difference is in the test routine signature. AUnit accepts only form procedure Nominal (T : in out AUnit.Test_Cases.Test_Case'Class); while Ahven accepts procedure Nominal (T : in out Ahven.Framework.Test_Case'Class); and procedure Nominal; > Then test_cases are added to suites: >=20 > 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= ); >=20 > This seems roughly equivalent to Ahven.=20 Yes. > AUnit also has setup and teardown functions for initializing and finalizi= ng > each test and/or each Test_Case; those are very helpful. Ahven supports setup and teardown procedures for each test. For each Test_Case you need to rely on Initialize and Finalize procedures provided by Ada.Finalization.Controlled. package body Simple_Tests is type Test_Access is access all Test; procedure Initialize (T : in out Test) is begin Set_Name (T, "Simple Tests"); Ahven.Framework.Add_Test_Routine (T, Test_Assertion'Access, "Test Assertion"); Ahven.Framework.Add_Test_Routine (T, Test_With_Object'Access, "Test With Object"); Ahven.Framework.Add_Test_Routine (T, Test_Error'Access, "Test Error (exception)"); end Initialize; =20 procedure Set_Up (T : in out Test) is begin Put_Line ("Simple_Tests.Set_Up"); T.Value :=3D 1; end Set_Up; =20 procedure Tear_Down (T : in out Test) is begin Put_Line ("Simple_Tests.Tear_Down"); T.Value :=3D -1; end Tear_Down; =20 procedure Test_Assertion is begin Put_Line ("Test_Assertion"); Ahven.Assert (False, "assert(false)"); end Test_Assertion; =20 procedure Test_Error is begin raise Constraint_Error; end Test_Error; procedure Hello (T : Test) is begin Ahven.Assert (T.Value =3D 1, "T.Value =3D 1"); end Hello; =20 procedure Test_With_Object (T : in out Ahven.Framework.Test_Case'Class) = is begin Put_Line ("Test_With_Object"); Hello (Test (T)); end Test_With_Object; end Simple_Tests; There are probably also other differences, but I don't want to spoil too much. ;) > --=20 > -- Stephe --=20 Tero Koskinen - http://iki.fi/tero.koskinen/